linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>
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: Wed, 8 Jan 2025 10:41:02 +0800	[thread overview]
Message-ID: <3dfe49b0-e852-4989-ac03-22418cc2e1a1@linux.alibaba.com> (raw)
In-Reply-To: <20250107182943.a36b6876985dac7d34ef07a2@linux-foundation.org>



On 2025/1/8 10:29, Andrew Morton wrote:
> 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)
> _

Yes, looks good to me. Thanks.


      reply	other threads:[~2025-01-08  2:41 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
2025-01-08  2:41   ` Baolin Wang [this message]

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=3dfe49b0-e852-4989-ac03-22418cc2e1a1@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --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