]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mm/shmem: remove unnecessary restrain unmask of swap gfp flags
authorKairui Song <kasong@tencent.com>
Wed, 11 Feb 2026 14:33:23 +0000 (22:33 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:01 +0000 (13:53 -0700)
The comment makes it look like copy-paste leftovers from
shmem_replace_folio.  The first try of the swap doesn't always have a
limited zone.

So don't drop the restraint, which should make the GFP more accurate.

Link: https://lkml.kernel.org/r/20260211-shmem-swap-gfp-v1-1-e9781099a861@tencent.com
Signed-off-by: Kairui Song <kasong@tencent.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c

index b40f3cd48961cf7fa38866b57681bfe72d22db08..cfed6c3ff853abed56fa32a16d28fa5da099bd85 100644 (file)
@@ -2044,14 +2044,8 @@ static struct folio *shmem_swap_alloc_folio(struct inode *inode,
        struct shmem_inode_info *info = SHMEM_I(inode);
        struct folio *new, *swapcache;
        int nr_pages = 1 << order;
-       gfp_t alloc_gfp;
+       gfp_t alloc_gfp = gfp;
 
-       /*
-        * We have arrived here because our zones are constrained, so don't
-        * limit chance of success with further cpuset and node constraints.
-        */
-       gfp &= ~GFP_CONSTRAINT_MASK;
-       alloc_gfp = gfp;
        if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
                if (WARN_ON_ONCE(order))
                        return ERR_PTR(-EINVAL);