From: Chris Li <chrisl@kernel.org>
To: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, baolin.wang@linux.alibaba.com,
mgorman@techsingularity.net, david@redhat.com,
willy@infradead.org
Subject: Re: [PATCH 1/2] mm/page_alloc: remove track of active PCP lists range in bulk free
Date: Thu, 17 Aug 2023 00:51:23 -0700 [thread overview]
Message-ID: <CAF8kJuMvLG6NL_r0Lnf5Un5bskrG6P6i4OhOVKFuhBQ5f9D91g@mail.gmail.com> (raw)
In-Reply-To: <53956bbf-844c-97da-2057-a8805360b35f@huaweicloud.com>
Hi Kemeng,
On Wed, Aug 16, 2023 at 7:22 PM Kemeng Shi <shikemeng@huaweicloud.com> wrote:
> Hi Chris, there is no functional change intended in this patch. As
> I menthioned in changelog, there is no wrap for list iteration, so
> that the active PCP lists range will never be used.
> > I have a patch sitting in my tree for a while related to this
> > count vs pcp->count. The BPF function hook can potentially change
> > pcp->count and make count out of sync with pcp->count which causes
> > a dead loop.
In this case the BPF allocates a page inside spin_lock. The "pcp->count" is
smaller than "count". The loop condition only checks "count > 0" but all
pcp->lists pages have been free. pcp->count is 0 but "count" is 1.
After a few times wrap around, the pindex_max is smaller than pindex_min,
then reach to -1 cause the invalid page fault.
> I guess pcp->count is set to bigger than it should be. In this case,
> we will keep trying get pages while all pages in pcp list were taken
> off already and dead lock will happen. In this case, dead looo will
> happen with or without this patch as the root cause is that we try
> to get pages more than pcp list owns.> Maybe I can send my out alone side with yours for discussion?
My patch is split into two parts, the first patch is a functional
change to allow
pcp->count drop below "count".
The other patch is just to clean up, and should have the same function.
Sure will send it out and CC you for discussion.
> > I don't mind my patch combined with yours.
> >
> Either way is acceptable to me, just feel free to choose one you like
> and I'd like to see if more we could do to this.
Thanks
Chris
next prev parent reply other threads:[~2023-08-17 7:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230809100754.3094517-1-shikemeng@huaweicloud.com>
2023-08-09 10:07 ` Kemeng Shi
2023-08-15 17:45 ` Chris Li
2023-08-17 2:22 ` Kemeng Shi
2023-08-17 7:51 ` Chris Li [this message]
2023-08-09 10:07 ` [PATCH 2/2] mm/page_alloc: remove unnecessary parameter batch of nr_pcp_free Kemeng Shi
2023-08-15 17:46 ` Chris Li
2023-08-17 2:43 ` Kemeng Shi
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=CAF8kJuMvLG6NL_r0Lnf5Un5bskrG6P6i4OhOVKFuhBQ5f9D91g@mail.gmail.com \
--to=chrisl@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=shikemeng@huaweicloud.com \
--cc=willy@infradead.org \
/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