From: Hugh Dickins <hughd@google.com>
To: Yang Shi <shy828301@gmail.com>
Cc: Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Usama Arif <usamaarif642@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>, Zi Yan <ziy@nvidia.com>,
Chris Li <chrisl@kernel.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH hotfix 2/2] mm/thp: fix deferred split unqueue naming and locking
Date: Sat, 26 Oct 2024 22:35:14 -0700 (PDT) [thread overview]
Message-ID: <88043c2c-0b7c-40e3-c5e7-47720cc66861@google.com> (raw)
In-Reply-To: <CAHbLzkqjO6X_k91xFFRG+5FLkzxvc0UKsUomW0_oYMv68TCHQg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2942 bytes --]
On Fri, 25 Oct 2024, Yang Shi wrote:
> On Thu, Oct 24, 2024 at 11:57 PM Hugh Dickins <hughd@google.com> wrote:
> > On Thu, 24 Oct 2024, Yang Shi wrote:
> > > On Wed, Oct 23, 2024 at 9:13 PM Hugh Dickins <hughd@google.com> wrote:
> > > > --- a/mm/page_alloc.c
> > > > +++ b/mm/page_alloc.c
> > > > @@ -2681,7 +2681,9 @@ void free_unref_folios(struct folio_batch *folios)
> > > > unsigned long pfn = folio_pfn(folio);
> > > > unsigned int order = folio_order(folio);
> > > >
> > > > - folio_undo_large_rmappable(folio);
> > > > + if (mem_cgroup_disabled())
> > > > + folio_unqueue_deferred_split(folio);
> > >
> > > This looks confusing. It looks all callsites of free_unref_folios()
> > > have folio_unqueue_deferred_split() and memcg uncharge called before
> > > it. If there is any problem, memcg uncharge should catch it. Did I
> > > miss something?
> >
> > I don't understand what you're suggesting there. But David remarked
> > on it too, so it seems that I do need at least to add some comment.
> >
> > I'd better re-examine the memcg/non-memcg forking paths again: but by
> > strange coincidence (or suggestion?), I'm suddenly now too tired here,
> > precisely where David stopped too. I'll have to come back to this
> > tomorrow, sorry.
>
> I perhaps misunderstood this code. Just feel free to correct me if it
> doesn't make sense to you. But, yes, some comments are definitely
> welcome and helpful for understanding the code and review.
Thanks a lot for challenging that: it was me who misunderstood, not you.
I might just be inventing this excuse, but I think what happened was,
I'd been staring at an earlier release tree, and in that earlier tree
the prior unqueueing was tucked away inside a memcg function, but not
done in the #ifndef CONFIG_MEMCG stub: so I thought that this
folio_unqueue_deferred_split() in free_unref_folios() was needed just
to do it when mem_cgroup_disabled() (either by CONFIG or bootoption).
And I thought the "if (mem_cgroup_disabled())" was comment enough:
except it made no sense to you and David who saw what I was blind to
(and what you describe perfectly clearly above - it depresses me
sometimes, how I cannot even read what someone wrote, until I've
arrived at the same conclusion myself!).
If my story about !memcg stubs is true, then I think Matthew has
been cleaning all that up recently. Except for put_pages_list()
(where I now see he wanted to insert a VM_BUG_ON(folio_memcg) in
April, but was forced to retreat): that one does not have a
folio_unqueue_deferred_split() in, but the good news is that
it no longer has any callers - I'll send a patch to delete it.
And instead of my misunderstood code above in free_unref_folios(),
just deleting the folio_undo_large_unmappable() line, with a
comment in the commit message.
Thanks!
Hugh
next prev parent reply other threads:[~2024-10-27 5:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 4:10 [PATCH hotfix 1/2] mm/thp: fix deferred split queue not partially_mapped 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 [this message]
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
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=88043c2c-0b7c-40e3-c5e7-47720cc66861@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