diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2019-09-23 18:34:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-24 18:54:08 -0400 |
commit | d8c6546b1aea843fbeb4d54a1202f1adda6504be (patch) | |
tree | 4b0fcc4a1afc9342472d59293b50fce20f2d70e7 /mm/shmem.c | |
parent | 94ad9338109fe9d0b8a4a16828719dd6dcaee4c2 (diff) |
mm: introduce compound_nr()
Replace 1 << compound_order(page) with compound_nr(page). Minor
improvements in readability.
Link: http://lkml.kernel.org/r/20190721104612.19120-4-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 0f7fd4a85db6..15d26c86e5ef 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -609,7 +609,7 @@ static int shmem_add_to_page_cache(struct page *page, | |||
609 | { | 609 | { |
610 | XA_STATE_ORDER(xas, &mapping->i_pages, index, compound_order(page)); | 610 | XA_STATE_ORDER(xas, &mapping->i_pages, index, compound_order(page)); |
611 | unsigned long i = 0; | 611 | unsigned long i = 0; |
612 | unsigned long nr = 1UL << compound_order(page); | 612 | unsigned long nr = compound_nr(page); |
613 | 613 | ||
614 | VM_BUG_ON_PAGE(PageTail(page), page); | 614 | VM_BUG_ON_PAGE(PageTail(page), page); |
615 | VM_BUG_ON_PAGE(index != round_down(index, nr), page); | 615 | VM_BUG_ON_PAGE(index != round_down(index, nr), page); |
@@ -1884,7 +1884,7 @@ alloc_nohuge: | |||
1884 | lru_cache_add_anon(page); | 1884 | lru_cache_add_anon(page); |
1885 | 1885 | ||
1886 | spin_lock_irq(&info->lock); | 1886 | spin_lock_irq(&info->lock); |
1887 | info->alloced += 1 << compound_order(page); | 1887 | info->alloced += compound_nr(page); |
1888 | inode->i_blocks += BLOCKS_PER_PAGE << compound_order(page); | 1888 | inode->i_blocks += BLOCKS_PER_PAGE << compound_order(page); |
1889 | shmem_recalc_inode(inode); | 1889 | shmem_recalc_inode(inode); |
1890 | spin_unlock_irq(&info->lock); | 1890 | spin_unlock_irq(&info->lock); |
@@ -1925,7 +1925,7 @@ clear: | |||
1925 | struct page *head = compound_head(page); | 1925 | struct page *head = compound_head(page); |
1926 | int i; | 1926 | int i; |
1927 | 1927 | ||
1928 | for (i = 0; i < (1 << compound_order(head)); i++) { | 1928 | for (i = 0; i < compound_nr(head); i++) { |
1929 | clear_highpage(head + i); | 1929 | clear_highpage(head + i); |
1930 | flush_dcache_page(head + i); | 1930 | flush_dcache_page(head + i); |
1931 | } | 1931 | } |
@@ -1952,7 +1952,7 @@ clear: | |||
1952 | * Error recovery. | 1952 | * Error recovery. |
1953 | */ | 1953 | */ |
1954 | unacct: | 1954 | unacct: |
1955 | shmem_inode_unacct_blocks(inode, 1 << compound_order(page)); | 1955 | shmem_inode_unacct_blocks(inode, compound_nr(page)); |
1956 | 1956 | ||
1957 | if (PageTransHuge(page)) { | 1957 | if (PageTransHuge(page)) { |
1958 | unlock_page(page); | 1958 | unlock_page(page); |