linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeel.butt@linux.dev>
To: Rik van Riel <riel@surriel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 "Huang, Ying" <ying.huang@intel.com>,
	Chris Li <chrisl@kernel.org>,
	 Ryan Roberts <ryan.roberts@arm.com>,
	David Hildenbrand <david@redhat.com>,
	 "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	 kernel-team@meta.com
Subject: Re: [PATCH] mm: add maybe_lru_add_drain() that only drains when threshold  is exceeded
Date: Thu, 19 Dec 2024 09:00:57 -0800	[thread overview]
Message-ID: <5x76zwpbqus2rjjoezidn3lt7tjuxon3xdx6g34vf2ryhz5kin@y5t2l2gdksok> (raw)
In-Reply-To: <acb8c972fe569bf0fcfe65a1d806b135d007ef88.camel@surriel.com>

On Wed, Dec 18, 2024 at 10:13:30PM -0500, Rik van Riel wrote:
> On Wed, 2024-12-18 at 12:20 -0800, Shakeel Butt wrote:
> > On Wed, Dec 18, 2024 at 11:56:04AM -0500, Rik van Riel wrote:
> > [...]
> > >  
> > > +static bool should_lru_add_drain(void)
> > > +{
> > > +	struct cpu_fbatches *fbatches =
> > > this_cpu_ptr(&cpu_fbatches);
> > 
> > You will need either a local_lock or preempt_disable to access the
> > per
> > cpu batches.
> > 
> Why is that? Can the per-cpu batches disappear on us
> while we're trying to access them, without that
> local_lock or preempt_disable?
> 
> I'm not trying to protect against accidentally reading
> the wrong CPU's numbers, since we could be preempted
> and migrated to another CPU immediately after returning
> from should_lru_add_drain, but do want to keep things
> safe against other potential issues.
> 

I was thinking of task migration across CPUs but it can still happen
while zap is ongoing. Yeah we might need to reevaluate if we really need
to drain here or do draining periodically.



  reply	other threads:[~2024-12-19 17:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 16:56 Rik van Riel
2024-12-18 20:20 ` Shakeel Butt
2024-12-19  3:13   ` Rik van Riel
2024-12-19 17:00     ` Shakeel Butt [this message]
2024-12-19 13:47 ` David Hildenbrand
2024-12-19 14:11   ` Rik van Riel
2024-12-19 17:23     ` David Hildenbrand
2024-12-19 17:50       ` Rik van Riel

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=5x76zwpbqus2rjjoezidn3lt7tjuxon3xdx6g34vf2ryhz5kin@y5t2l2gdksok \
    --to=shakeel.butt@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@surriel.com \
    --cc=ryan.roberts@arm.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.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