mm: shmem: extend shmem_unused_huge_shrink() to all sizes
authorHugh Dickins <hughd@google.com>
Sun, 25 Aug 2024 23:25:39 +0000 (16:25 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 9 Sep 2024 23:39:02 +0000 (16:39 -0700)
commit15444054a537aca115bb077a77e99a9cc5ae11e6
tree3cf66b4057a97ae2d77b48d1d0e3c9f8874e2d3c
parentde5b85262e2038a5ae5d281ddf43d35acb2bfa60
mm: shmem: extend shmem_unused_huge_shrink() to all sizes

Although shmem_get_folio_gfp() is correctly putting inodes on the
shrinklist according to the folio size, shmem_unused_huge_shrink() was
still dealing with that shrinklist in terms of HPAGE_PMD_SIZE.

Generalize that; and to handle the mixture of sizes more sensibly,
shmem_alloc_and_add_folio() give it a number of pages to be freed
(approximate: no need to minimize that with an exact calculation) instead
of a number of inodes to split.

[akpm@linux-foundation.org: comment tweak, per David]
Link: https://lkml.kernel.org/r/d8c40850-6774-7a93-1e2c-8d941683b260@google.com
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c