On Thu, Oct 23, 2025 at 1:51 PM Barry Song 21cnbao@gmail.com wrote:
diff --git a/mm/shmem.c b/mm/shmem.c index b50ce7dbc84a..7559773ebb30 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1895,10 +1895,11 @@ static struct folio *shmem_alloc_and_add_folio(struct vm_fault *vmf, order = highest_order(suitable_orders); while (suitable_orders) { pages = 1UL << order;
index = round_down(index, pages);folio = shmem_alloc_folio(gfp, order, info, index);if (folio)
folio = shmem_alloc_folio(gfp, order, info, round_down(index, pages));if (folio) {index = round_down(index, pages); goto allocated;}Could this be a temporary variable to store round_down(index, pages)?
Right we can do that, but the generated code should be the same, the compiler is smart enough, I just checked the generated code with gcc / clang.
Do you think the code will be cleaner with a temporary variable? I can send a V3 if anyone suggests, it's really a trivial change.