public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail•com>
To: Petr Mladek <pmladek@suse•com>
Cc: chensong_2000@189•cn, rafael@kernel•org, lenb@kernel•org,
	mturquette@baylibre•com, sboyd@kernel•org,
	viresh.kumar@linaro•org, agk@redhat•com, snitzer@kernel•org,
	mpatocka@redhat•com, bmarzins@redhat•com, song@kernel•org,
	yukuai@fnnas•com, linan122@huawei•com,
	jason.wessel@windriver•com, danielt@kernel•org,
	dianders@chromium•org, horms@kernel•org, davem@davemloft•net,
	edumazet@google•com, kuba@kernel•org, pabeni@redhat•com,
	paulmck@kernel•org, frederic@kernel•org, mcgrof@kernel•org,
	petr.pavlu@suse•com, da.gomez@kernel•org,
	samitolvanen@google•com, atomlin@atomlin•com,
	jpoimboe@kernel•org, jikos@kernel•org, mbenes@suse•cz,
	joe.lawrence@redhat•com, rostedt@goodmis•org,
	mhiramat@kernel•org, mark.rutland@arm•com,
	mathieu.desnoyers@efficios•com, linux-modules@vger•kernel.org,
	linux-kernel@vger•kernel.org, linux-trace-kernel@vger•kernel.org,
	linux-acpi@vger•kernel.org, linux-clk@vger•kernel.org,
	linux-pm@vger•kernel.org, live-patching@vger•kernel.org,
	dm-devel@lists•linux.dev, linux-raid@vger•kernel.org,
	kgdb-bugreport@lists•sourceforge.net, netdev@vger•kernel.org
Subject: Re: [RFC PATCH 1/2] kernel/notifier: replace single-linked list with double-linked list for reverse traversal
Date: Thu, 16 Apr 2026 20:15:39 +0100	[thread overview]
Message-ID: <20260416201539.2cee3b99@pumpkin> (raw)
In-Reply-To: <aeD4H8P1DiPQoM8V@pathway.suse.cz>

On Thu, 16 Apr 2026 16:54:23 +0200
Petr Mladek <pmladek@suse•com> wrote:

> On Thu 2026-04-16 13:30:04, David Laight wrote:
> > On Wed, 15 Apr 2026 15:01:37 +0800
> > chensong_2000@189•cn wrote:
> >   
> > > From: Song Chen <chensong_2000@189•cn>
> > > 
> > > The current notifier chain implementation uses a single-linked list
> > > (struct notifier_block *next), which only supports forward traversal
> > > in priority order. This makes it difficult to handle cleanup/teardown
> > > scenarios that require notifiers to be called in reverse priority order.  
> > 
> > If it is only cleanup/teardown then the list can be order-reversed
> > as part of that process at the same time as the list is deleted.  
> 
> Interesting idea. But it won't work in all situations.

It is useful for things like locklessy queuing a request to be processed later.
Items can be added with a cmpxchg and the list grabbed by xchg of NULL.
The only downside is that reversing a list isn't cache friendly.
Thinks... although that may not be any worse than accessing the current 'tail'
to add to the end of a doubly linked (or singly linked with a tail ptr) list.

	David

> 
> Note that the motivation for this update are the module loader
> notifiers which are called several times for each loaded/removed module.
> 
> Best Regards,
> Petr
> 


  reply	other threads:[~2026-04-16 19:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15  7:01 [RFC PATCH 1/2] kernel/notifier: replace single-linked list with double-linked list for reverse traversal chensong_2000
2026-04-15  7:40 ` Christoph Hellwig
2026-04-16 10:33 ` Petr Mladek
2026-04-19  0:07   ` Song Chen
2026-04-16 12:30 ` David Laight
2026-04-16 14:54   ` Petr Mladek
2026-04-16 19:15     ` David Laight [this message]
2026-04-19  0:21   ` Song Chen
2026-04-20  5:44 ` Masami Hiramatsu
2026-04-21  9:05   ` Petr Mladek
2026-04-26 13:56     ` Song Chen
2026-04-26 14:14   ` Song Chen

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=20260416201539.2cee3b99@pumpkin \
    --to=david.laight.linux@gmail$(echo .)com \
    --cc=agk@redhat$(echo .)com \
    --cc=atomlin@atomlin$(echo .)com \
    --cc=bmarzins@redhat$(echo .)com \
    --cc=chensong_2000@189$(echo .)cn \
    --cc=da.gomez@kernel$(echo .)org \
    --cc=danielt@kernel$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=dianders@chromium$(echo .)org \
    --cc=dm-devel@lists$(echo .)linux.dev \
    --cc=edumazet@google$(echo .)com \
    --cc=frederic@kernel$(echo .)org \
    --cc=horms@kernel$(echo .)org \
    --cc=jason.wessel@windriver$(echo .)com \
    --cc=jikos@kernel$(echo .)org \
    --cc=joe.lawrence@redhat$(echo .)com \
    --cc=jpoimboe@kernel$(echo .)org \
    --cc=kgdb-bugreport@lists$(echo .)sourceforge.net \
    --cc=kuba@kernel$(echo .)org \
    --cc=lenb@kernel$(echo .)org \
    --cc=linan122@huawei$(echo .)com \
    --cc=linux-acpi@vger$(echo .)kernel.org \
    --cc=linux-clk@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-modules@vger$(echo .)kernel.org \
    --cc=linux-pm@vger$(echo .)kernel.org \
    --cc=linux-raid@vger$(echo .)kernel.org \
    --cc=linux-trace-kernel@vger$(echo .)kernel.org \
    --cc=live-patching@vger$(echo .)kernel.org \
    --cc=mark.rutland@arm$(echo .)com \
    --cc=mathieu.desnoyers@efficios$(echo .)com \
    --cc=mbenes@suse$(echo .)cz \
    --cc=mcgrof@kernel$(echo .)org \
    --cc=mhiramat@kernel$(echo .)org \
    --cc=mpatocka@redhat$(echo .)com \
    --cc=mturquette@baylibre$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=paulmck@kernel$(echo .)org \
    --cc=petr.pavlu@suse$(echo .)com \
    --cc=pmladek@suse$(echo .)com \
    --cc=rafael@kernel$(echo .)org \
    --cc=rostedt@goodmis$(echo .)org \
    --cc=samitolvanen@google$(echo .)com \
    --cc=sboyd@kernel$(echo .)org \
    --cc=snitzer@kernel$(echo .)org \
    --cc=song@kernel$(echo .)org \
    --cc=viresh.kumar@linaro$(echo .)org \
    --cc=yukuai@fnnas$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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