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.

filemap: remove redundant folio_test_large check in filemap_free_folio

The folio_test_large() check in filemap_free_folio() is unnecessary
because folio_nr_pages(), which is called internally already performs this
check. Removing the redundant condition simplifies the code and avoids
double validation.

This change improves code readability and reduces unnecessary operations
in the folio freeing path.

Link: https://lkml.kernel.org/r/20250213055612.490993-1-guanjun@linux.alibaba.com
Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Guanjun and committed by
Andrew Morton
b23ceebd 18ea595a

+1 -4
+1 -4
mm/filemap.c
··· 227 227 void filemap_free_folio(struct address_space *mapping, struct folio *folio) 228 228 { 229 229 void (*free_folio)(struct folio *); 230 - int refs = 1; 231 230 232 231 free_folio = mapping->a_ops->free_folio; 233 232 if (free_folio) 234 233 free_folio(folio); 235 234 236 - if (folio_test_large(folio)) 237 - refs = folio_nr_pages(folio); 238 - folio_put_refs(folio, refs); 235 + folio_put_refs(folio, folio_nr_pages(folio)); 239 236 } 240 237 241 238 /**