mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Longlong Xia <xialonglong2025@163.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>, xu.xin16@zte.com.cn
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	chengming.zhou@linux.dev, linux-kernel@vger.kernel.org,
	xialonglong@kylinos.cn
Subject: Re: [PATCH 1/1] mm/ksm: trylock the mmap lock in the unstable tree walk
Date: Thu, 10 Sep 2026 08:51:31 +0800	[thread overview]
Message-ID: <84bb8f53-54ff-4153-845f-e085ec649d36@163.com> (raw)
In-Reply-To: <91cf8129-d705-4ebd-b420-129bab7ed261@kernel.org>

Thanks for the review.

在 2026/9/9 23:17, David Hildenbrand (Arm) 写道:
>>> index 49d48d1e0998..3cfb09a926ff 100644
>>> --- a/mm/ksm.c
>>> +++ b/mm/ksm.c
>>> @@ -820,7 +820,14 @@ static struct page *get_mergeable_page(struct ksm_rmap_item *rmap_item)
>>>   	struct folio_walk fw;
>>>   	struct folio *folio;
>>>   
>>> -	mmap_read_lock(mm);
>>> +	/*
>>> +	 * We trylock because we don't want ksmd to wait for an mm that is
>>> +	 * busy changing its memory layout: we prefer to skip this page and
>>> +	 * let the next full scan retry it, like the folio trylock in
>>> +	 * try_to_merge_one_page().
>>> +	 */
>>> +	if (!mmap_read_trylock(mm))
>>> +		return NULL;
>>>   	vma = find_mergeable_vma(mm, addr);
>>>   	if (!vma)
>>>   		goto out;
>>> -- 
>>> 2.43.0
>> Sorry, NACK
> Agreed. Likely the answer is to switch to per-vma locks here. All we do is a
> folio_walk_start() to look up a page, that's not too crazy :)

Thanks for the suggestions — I'll explore this further.


Thanks,

Longlong


  reply	other threads:[~2026-09-10  0:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  2:35 Longlong Xia
2026-09-09  3:02 ` xu.xin16
2026-09-09 15:17   ` David Hildenbrand (Arm)
2026-09-10  0:51     ` Longlong Xia [this message]
2026-09-10  0:47   ` Longlong Xia

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=84bb8f53-54ff-4153-845f-e085ec649d36@163.com \
    --to=xialonglong2025@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xialonglong@kylinos.cn \
    --cc=xu.xin16@zte.com.cn \
    /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

all inboxes | Powered by JetHome®