mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kaitao Cheng <kaitao.cheng@linux.dev>
Cc: "David Laight" <david.laight.linux@gmail.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Hildenbrand" <david@kernel.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Nicolas Schier" <nsc@kernel.org>,
	"Christian Brauner" <brauner@kernel.org>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	"David Howells" <dhowells@redhat.com>,
	"Simona Vetter" <simona.vetter@ffwll.ch>,
	"Neeraj Upadhyay" <neeraj.upadhyay@kernel.org>,
	"Luca Ceresoli" <luca.ceresoli@bootlin.com>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Kaitao Cheng" <chengkaitao@kylinos.cn>,
	"Philipp Stanner" <phasta@kernel.org>,
	"Alex Williamson" <alex@shazbot.org>,
	"David Matlack" <dmatlack@google.com>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Joy H . J . Lee" <rkr0k0r@gmail.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ian Rogers" <irogers@google.com>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Swapnil Sapkal" <swapnil.sapkal@amd.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 0/4] Prepare mutable list iterators to cache cursor state
Date: Thu, 30 Jul 2026 12:11:51 -0700	[thread overview]
Message-ID: <20260730121151.9d0577c2772b70c5e648b27d@linux-foundation.org> (raw)
In-Reply-To: <20260730095041.35715-1-kaitao.cheng@linux.dev>

On Thu, 30 Jul 2026 17:50:32 +0800 Kaitao Cheng <kaitao.cheng@linux.dev> wrote:

> The list_for_each*_safe() helpers are used when the loop body may remove
> the current entry.  Their current interface, however, forces every caller
> to define a temporary cursor outside the macro and pass it in, even when
> the caller never uses that cursor directly.  For most call sites this
> extra cursor is just boilerplate required by the macro implementation.
> 
> This is awkward because the saved next pointer is an internal detail of
> the iteration.  Callers that only remove or move the current entry do not
> need to spell it out.
> 
> The _safe() suffix has also caused confusion.  Christian Koenig pointed
> out that the name is easy to read as a thread-safe variant, especially
> for beginners, even though it only means that the iterator keeps enough
> state to tolerate removal of the current entry.  He suggested _mutable()
> as a clearer description of what the loop permits.
> 
> Add *_mutable() iterator variants for list, hlist and llist. The caller
> omits the temporary cursor and the macro creates a unique internal cursor
> with typeof(pos) and __UNIQUE_ID(). The existing *_safe() helpers remain
> available for compatibility.

I can't say I'm very motivated about this proposal, sorry.

It adds nearly 500 lines of tricky new macros.

It churns ancient interfaces which have more than 6,000 callsites.  Are
maintainers to spend the next decade receiving "switch to *_mutable"
cleanups?

Unless I'm missing something here, my vote is to let it be and go do
more productive things.

      parent reply	other threads:[~2026-07-30 19:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  9:50 Kaitao Cheng
2026-07-30  9:50 ` [PATCH v4 1/4] list: Add mutable iterator variants Kaitao Cheng
2026-07-31  6:54   ` Philipp Stanner
2026-08-07  0:39     ` Andy Shevchenko
2026-07-30  9:50 ` [PATCH v4 2/4] llist: " Kaitao Cheng
2026-07-30  9:50 ` [PATCH v4 3/4] tools/list: " Kaitao Cheng
2026-07-30  9:50 ` [PATCH v4 4/4] scripts/list: " Kaitao Cheng
2026-07-30 19:11 ` Andrew Morton [this message]

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=20260730121151.9d0577c2772b70c5e648b27d@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alex@shazbot.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brauner@kernel.org \
    --cc=chengkaitao@kylinos.cn \
    --cc=christian.koenig@amd.com \
    --cc=david.laight.linux@gmail.com \
    --cc=david@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=dmatlack@google.com \
    --cc=irogers@google.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=kaitao.cheng@linux.dev \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=namhyung@kernel.org \
    --cc=nathan@kernel.org \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=nsc@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=phasta@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rkr0k0r@gmail.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=skhan@linuxfoundation.org \
    --cc=swapnil.sapkal@amd.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

all inboxes | Powered by JetHome®