linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Rik van Riel <riel@surriel.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>,
	David Hildenbrand <david@redhat.com>,
	Chris Li <chrisl@kernel.org>, Ryan Roberts <ryan.roberts@arm.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-mm@kvack.org, kernel-team@meta.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: remove unnecessary calls to lru_add_drain
Date: Thu, 19 Dec 2024 14:14:29 -0800	[thread overview]
Message-ID: <20241219141429.165830ca3f405d5fd08be353@linux-foundation.org> (raw)
In-Reply-To: <20241219153253.3da9e8aa@fangorn>

On Thu, 19 Dec 2024 15:32:53 -0500 Rik van Riel <riel@surriel.com> wrote:

> There seem to be several categories of calls to lru_add_drain
> and lru_add_drain_all.
> 
> The first are code paths that recently allocated, swapped in,
> or otherwise processed a batch of pages, and want them all on
> the LRU. These drain pages that were recently allocated,
> probably on the local CPU.
> 
> A second category are code paths that are actively trying to
> reclaim, migrate, or offline memory. These often use lru_add_drain_all,
> to drain the caches on all CPUs.
> 
> However, there also seem to be some other callers where we
> aren't really doing either. They are calling lru_add_drain(),
> despite operating on pages that may have been allocated
> long ago, and quite possibly on different CPUs.
> 
> Those calls are not likely to be effective at anything but
> creating lock contention on the LRU locks.
> 
> Remove the lru_add_drain calls in the latter category.

These lru_add_drain() calls are the sorts of things we've added as
bugfixes when things go weird in unexpected situations.  So the need
for them can be obscure.

I'd be more comfortable if we'd gone through them all, hunted down the
commits which added them, learned why these calls were added then
explained why that reasoning is no longer valid.


A lot of the ones you're removing precede a tlb_gather_mmu() operation.
I wonder why we have (or had) that pattern?



  reply	other threads:[~2024-12-19 22:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19 20:32 Rik van Riel
2024-12-19 22:14 ` Andrew Morton [this message]
2024-12-20  2:00   ` Rik van Riel
2024-12-21  1:10 ` Shakeel Butt
2024-12-21 15:32   ` David Hildenbrand
2025-01-02 15:53   ` Lorenzo Stoakes

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=20241219141429.165830ca3f405d5fd08be353@linux-foundation.org \
    --to=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=shakeel.butt@linux.dev \
    --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