From: Andrew Morton <akpm@linux-foundation.org>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: hughd@google.com, willy@infradead.org, david@redhat.com,
wangkefeng.wang@huawei.com, kasong@tencent.com,
ying.huang@linux.alibaba.com, 21cnbao@gmail.com,
ryan.roberts@arm.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] mm: shmem: skip swapcache for swapin of synchronous swap device
Date: Tue, 7 Jan 2025 18:29:43 -0800 [thread overview]
Message-ID: <20250107182943.a36b6876985dac7d34ef07a2@linux-foundation.org> (raw)
In-Reply-To: <3d9f3bd3bc6ec953054baff5134f66feeaae7c1e.1736301701.git.baolin.wang@linux.alibaba.com>
On Wed, 8 Jan 2025 10:16:49 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:
> +static struct folio *shmem_swap_alloc_folio(struct inode *inode,
> + struct vm_area_struct *vma, pgoff_t index,
> + swp_entry_t entry, int order, gfp_t gfp)
> +{
> + struct shmem_inode_info *info = SHMEM_I(inode);
> + struct folio *new;
> + void *shadow;
> + int nr_pages;
> +
> + /*
> + * We have arrived here because our zones are constrained, so don't
> + * limit chance of success by further cpuset and node constraints.
> + */
> + gfp &= ~GFP_CONSTRAINT_MASK;
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> + if (order > 0) {
> + gfp_t huge_gfp = vma_thp_gfp_mask(vma);
> +
> + gfp = limit_gfp_mask(huge_gfp, gfp);
> + }
> +#endif
> +
Can we do this?
--- a/mm/shmem.c~mm-shmem-skip-swapcache-for-swapin-of-synchronous-swap-device-fix
+++ a/mm/shmem.c
@@ -1978,16 +1978,14 @@ static struct folio *shmem_swap_alloc_fo
/*
* We have arrived here because our zones are constrained, so don't
- * limit chance of success by further cpuset and node constraints.
+ * limit chance of success with further cpuset and node constraints.
*/
gfp &= ~GFP_CONSTRAINT_MASK;
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
- if (order > 0) {
+ if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && order > 0) {
gfp_t huge_gfp = vma_thp_gfp_mask(vma);
gfp = limit_gfp_mask(huge_gfp, gfp);
}
-#endif
new = shmem_alloc_folio(gfp, order, info, index);
if (!new)
_
next prev parent reply other threads:[~2025-01-08 2:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 2:16 Baolin Wang
2025-01-08 2:29 ` Andrew Morton [this message]
2025-01-08 2:41 ` Baolin Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250107182943.a36b6876985dac7d34ef07a2@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=21cnbao@gmail.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=wangkefeng.wang@huawei.com \
--cc=willy@infradead.org \
--cc=ying.huang@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome