linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/shmem: remove unnecessary restrain unmask of swap gfp flags
@ 2026-02-11 14:33 Kairui Song
  2026-02-14  7:15 ` Baolin Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Kairui Song @ 2026-02-11 14:33 UTC (permalink / raw)
  To: linux-mm
  Cc: Andrew Morton, Hugh Dickins, Baolin Wang, linux-kernel, Kairui Song

From: Kairui Song <kasong@tencent.com>

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.

Signed-off-by: Kairui Song <kasong@tencent.com>
---
 mm/shmem.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index eaaeca8f6c39..4f34dfa95a50 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2043,14 +2043,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);

---
base-commit: ad92386d5debbde551129dc85f0118f5a521388c
change-id: 20260211-shmem-swap-gfp-c68b9d73a90f

Best regards,
-- 
Kairui Song <kasong@tencent.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/shmem: remove unnecessary restrain unmask of swap gfp flags
  2026-02-11 14:33 [PATCH] mm/shmem: remove unnecessary restrain unmask of swap gfp flags Kairui Song
@ 2026-02-14  7:15 ` Baolin Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Baolin Wang @ 2026-02-14  7:15 UTC (permalink / raw)
  To: Kairui Song, linux-mm
  Cc: Andrew Morton, Hugh Dickins, linux-kernel, Kairui Song



On 2/11/26 10:33 PM, Kairui Song wrote:
> From: Kairui Song <kasong@tencent.com>
> 
> 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.
> 
> Signed-off-by: Kairui Song <kasong@tencent.com>
> ---

Agree. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

>   mm/shmem.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index eaaeca8f6c39..4f34dfa95a50 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2043,14 +2043,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);
> 
> ---
> base-commit: ad92386d5debbde551129dc85f0118f5a521388c
> change-id: 20260211-shmem-swap-gfp-c68b9d73a90f
> 
> Best regards,



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-14  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-11 14:33 [PATCH] mm/shmem: remove unnecessary restrain unmask of swap gfp flags Kairui Song
2026-02-14  7:15 ` Baolin Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox