From: Hugh Dickins <hughd@google.com>
To: Zi Yan <ziy@nvidia.com>
Cc: Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Usama Arif <usamaarif642@gmail.com>,
Yang Shi <shy828301@gmail.com>,
Wei Yang <richard.weiyang@gmail.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Matthew Wilcox <willy@infradead.org>,
David Hildenbrand <david@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Barry Song <baohua@kernel.org>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
Ryan Roberts <ryan.roberts@arm.com>,
Nhat Pham <nphamcs@gmail.com>, Chris Li <chrisl@kernel.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH hotfix 1/2] mm/thp: fix deferred split queue not partially_mapped
Date: Sat, 26 Oct 2024 21:43:09 -0700 (PDT) [thread overview]
Message-ID: <947f23e2-c817-b714-57d7-c893aad5002f@google.com> (raw)
In-Reply-To: <E5A75697-55C7-4335-8D86-EE5CB6A99C4F@nvidia.com>
On Fri, 25 Oct 2024, Zi Yan wrote:
>
> Thank you a lot for taking the time to check the locked version. Looking
> forward to the result.
The locked version worked fine (I did see some unusual filesystem on loop
errors on this laptop, but very much doubt that was related to the extra
deferred split queue locking). But I do still prefer the original version.
> BTW, I am not going to block this patch since it fixes the bug.
Thanks! I'll put out the same as v2 1/2.
>
> The tricky part in deferred_list_scan() is always the use of
> folio->_deferred_list without taking split_queue_lock. I am thinking about
> use folio_batch to store the out-of-split_queue folios, so that _deferred_list
> will not be touched when these folios are tried to be split. Basically,
>
> 1. loop through split_queue and move folios to a folio_batch until the
> folio_batch is full;
> 2. loop through the folio_batch to try to split each folio;
> 3. move the remaining folios back to split_queue.
>
> With this approach, split_queue_lock might be taken more if there are
> more than 31 (folio_batch max size) folios on split_queue and split_queue_lock
> will be held longer in step 3, since the remaining folios need to be
> added back to split_queue one by one instead of a single list splice.
>
> Let me know your thoughts. I can look into this if this approach sounds
> promising. Thanks.
TBH, I just don't see the point: we have a working mechanism, and
complicating it to rely on more infrastructure, just to reach the
same endpoint, seems a waste of developer time to me. It's not as
if a folio_batch there would make the split handling more efficient.
It would disambiguate the list_empty(), sure; but as it stands,
there's nothing in the handling which needs that disambiguated.
I can half-imagine that a folio_batch might become a better technique,
if we go on to need less restricted use of the deferred split queue:
if for some reason we grow to want to unqueue a THP while it's still
in use (as memcg move wanted in 2/2, but was not worth recoding for).
But I'm not sure whether a folio_batch would actually help there,
and I wouldn't worry about it unless there's a need.
Hugh
next prev parent reply other threads:[~2024-10-27 4:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 4:10 Hugh Dickins
2024-10-24 4:13 ` [PATCH hotfix 2/2] mm/thp: fix deferred split unqueue naming and locking Hugh Dickins
2024-10-24 20:00 ` Yang Shi
2024-10-25 1:21 ` Yang Shi
2024-10-25 6:57 ` Hugh Dickins
2024-10-25 16:34 ` Yang Shi
2024-10-27 5:35 ` Hugh Dickins
2024-10-24 20:52 ` David Hildenbrand
2024-10-25 1:25 ` Yang Shi
2024-10-27 7:07 ` Hugh Dickins
2024-10-24 10:20 ` [PATCH hotfix 1/2] mm/thp: fix deferred split queue not partially_mapped Usama Arif
2024-10-24 20:39 ` David Hildenbrand
2024-10-24 22:37 ` Zi Yan
2024-10-25 5:41 ` Hugh Dickins
2024-10-25 15:32 ` Zi Yan
2024-10-25 18:36 ` Yang Shi
2024-10-27 5:08 ` Hugh Dickins
2024-10-28 18:36 ` Yang Shi
2024-10-27 4:43 ` Hugh Dickins [this message]
2024-10-25 1:56 ` 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=947f23e2-c817-b714-57d7-c893aad5002f@google.com \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=chrisl@kernel.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=richard.weiyang@gmail.com \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=usamaarif642@gmail.com \
--cc=wangkefeng.wang@huawei.com \
--cc=willy@infradead.org \
--cc=ziy@nvidia.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