Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/nommu: convert kobjsize() to folios

Simple folio conversion to remove a user of PageSlab() and PageCompound().

Link: https://lkml.kernel.org/r/20250804145117.3857308-1-sidhartha.kumar@oracle.com
Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Sidhartha Kumar and committed by
Andrew Morton
1097a3d4 17387969

+7 -7
+7 -7
mm/nommu.c
··· 64 64 */ 65 65 unsigned int kobjsize(const void *objp) 66 66 { 67 - struct page *page; 67 + struct folio *folio; 68 68 69 69 /* 70 70 * If the object we have should not have ksize performed on it, ··· 73 73 if (!objp || !virt_addr_valid(objp)) 74 74 return 0; 75 75 76 - page = virt_to_head_page(objp); 76 + folio = virt_to_folio(objp); 77 77 78 78 /* 79 79 * If the allocator sets PageSlab, we know the pointer came from 80 80 * kmalloc(). 81 81 */ 82 - if (PageSlab(page)) 82 + if (folio_test_slab(folio)) 83 83 return ksize(objp); 84 84 85 85 /* 86 - * If it's not a compound page, see if we have a matching VMA 86 + * If it's not a large folio, see if we have a matching VMA 87 87 * region. This test is intentionally done in reverse order, 88 88 * so if there's no VMA, we still fall through and hand back 89 - * PAGE_SIZE for 0-order pages. 89 + * PAGE_SIZE for 0-order folios. 90 90 */ 91 - if (!PageCompound(page)) { 91 + if (!folio_test_large(folio)) { 92 92 struct vm_area_struct *vma; 93 93 94 94 vma = find_vma(current->mm, (unsigned long)objp); ··· 100 100 * The ksize() function is only guaranteed to work for pointers 101 101 * returned by kmalloc(). So handle arbitrary pointers here. 102 102 */ 103 - return page_size(page); 103 + return folio_size(folio); 104 104 } 105 105 106 106 void vfree(const void *addr)