linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>, John Dias <joaodias@google.com>,
	Tim Murray <timmurray@google.com>,
	Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: Re: [PATCH] mm: don't be stuck to rmap lock on reclaim path
Date: Thu, 5 May 2022 01:42:17 +0100	[thread overview]
Message-ID: <YnMdaW67GEDF0Ynr@casper.infradead.org> (raw)
In-Reply-To: <YnMQp/zJVHu9Qq/S@google.com>

On Wed, May 04, 2022 at 04:47:51PM -0700, Minchan Kim wrote:
> Since this patch introduces a new "contended" field as out param
> in rmap_walk_control, it's not immutable any longer so remove
> const keywords on rmap related functions. Since rmap walking
> is already expensive operation, I doubt the const would help sizable
> benefit(And we didn't have it until 5.17).

Um?  If it's now mutable, it surely can't be static as that means it
would be shared by all callers, and you might write to the new fields
in one caller and have them interpreted by the other caller!

Or if it is safe, then the comment needs to not be deleted, but modified
to explain why it's safe to do so in this instance, and that other
instances should not copy the approach unless they are similarly safe.

> diff --git a/mm/page_idle.c b/mm/page_idle.c
> index fc0435abf909..fdff8c6dcd2d 100644
> --- a/mm/page_idle.c
> +++ b/mm/page_idle.c
> @@ -86,11 +86,8 @@ static bool page_idle_clear_pte_refs_one(struct folio *folio,
>  static void page_idle_clear_pte_refs(struct page *page)
>  {
>  	struct folio *folio = page_folio(page);
> -	/*
> -	 * Since rwc.arg is unused, rwc is effectively immutable, so we
> -	 * can make it static const to save some cycles and stack.
> -	 */
> -	static const struct rmap_walk_control rwc = {
> +
> +	static struct rmap_walk_control rwc = {
>  		.rmap_one = page_idle_clear_pte_refs_one,
>  		.anon_lock = folio_lock_anon_vma_read,
>  	};


  reply	other threads:[~2022-05-05  0:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 17:03 [PATCH] mm: don't be stuck to rmap lock on reclaim path Minchan Kim
2022-05-04  2:13 ` kernel test robot
2022-05-04  3:24 ` kernel test robot
2022-05-04  3:32 ` Matthew Wilcox
2022-05-04  4:30   ` Minchan Kim
2022-05-04  6:09     ` Matthew Wilcox
2022-05-04 15:52       ` Minchan Kim
2022-05-04 16:55         ` Matthew Wilcox
2022-05-04 23:47           ` Minchan Kim
2022-05-05  0:42             ` Matthew Wilcox [this message]
2022-05-05  6:11               ` Minchan Kim
2022-05-17 23:58                 ` Andrew Morton

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=YnMdaW67GEDF0Ynr@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=joaodias@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=surenb@google.com \
    --cc=timmurray@google.com \
    --cc=vdavydov.dev@gmail.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;
as well as URLs for NNTP newsgroup(s).