linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>, Chris Mason <clm@fb.com>,
	Michal Hocko <mhocko@suse.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: Occasionally relinquish zone lock in batch freeing
Date: Thu, 21 Aug 2025 09:03:06 +0800	[thread overview]
Message-ID: <20250821010307.5142-1-hdanton@sina.com> (raw)
In-Reply-To: <20250820151307.1821686-1-joshua.hahnjy@gmail.com>

On Wed, 20 Aug 2025 08:13:07 -0700 Joshua Hahn wrote:
> On Wed, 20 Aug 2025 09:29:00 +0800 Hillf Danton <hdanton@sina.com> wrote:
> > On Mon, 18 Aug 2025 11:58:03 -0700 Joshua Hahn wrote:
> > > 
> > > While testing workloads with high sustained memory pressure on large machines
> > > (1TB memory, 316 CPUs), we saw an unexpectedly high number of softlockups.
> > > Further investigation showed that the lock in free_pcppages_bulk was being held
> > > for a long time, even being held while 2k+ pages were being freed.
> > > 
> > > Instead of holding the lock for the entirety of the freeing, check to see if
> > > the zone lock is contended every pcp->batch pages. If there is contention,
> > > relinquish the lock so that other processors have a change to grab the lock
> > > and perform critical work.
> > > 
> > Instead of the unlock/lock game, simply return with the rest left to workqueue
> > in case of lock contension. But workqueue is still unable to kill soft lockup
> > if the number of contending CPUs is large enough.
> 
> Thank you for the idea. One concern that I have is that sometimes, we do expect
> free_pcppages_bulk to actually free all of the pages that it has promised to
> do. One example is when it is called from drain_zone_pages. Of course, we can
> have a while loop that would call free_pcppages_bulk until it returns 0, but
> I think that would be reduced to unlocking / locking over and over again.
> 
In the case of drain_zone_pages(), I think adding something like the pcpu_drain_mutex
to the path updating zone counters is a cure.


  reply	other threads:[~2025-08-21  1:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18 18:58 Joshua Hahn
2025-08-19  0:13 ` Andrew Morton
2025-08-19 15:18   ` Joshua Hahn
2025-08-19 21:44     ` Andrew Morton
2025-08-20 13:20       ` Joshua Hahn
2025-08-19  9:15 ` Kiryl Shutsemau
2025-08-19 15:28   ` Joshua Hahn
2025-08-19 17:15   ` Shakeel Butt
2025-08-20 12:58     ` Kiryl Shutsemau
2025-08-19 15:34 ` Joshua Hahn
2025-08-20  1:29 ` Hillf Danton
2025-08-20 15:13   ` Joshua Hahn
2025-08-21  1:03     ` Hillf Danton [this message]
2025-08-20  5:41 ` Andrew Morton
2025-08-20 15:48   ` Joshua Hahn

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=20250821010307.5142-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=akpm@linux-foundation.org \
    --cc=clm@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.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