From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jakob Koschel <jakobkoschel@gmail.com>
Cc: Xiaomeng Tong <xiam0nd.tong@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jann Horn <jannh@google.com>, Kees Cook <keescook@chromium.org>,
Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>, Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH 2/6] list: add new MACROs to make iterator invisiable outside the loop
Date: Sun, 6 Mar 2022 10:57:15 -0800 [thread overview]
Message-ID: <CAHk-=whSRNrhxx__Zo5mpKGKZ9BVwCqHCUcfxfBF4VPfFx8edA@mail.gmail.com> (raw)
In-Reply-To: <634CBC77-281E-421C-9ED9-DB9E7224E7EA@gmail.com>
On Sun, Mar 6, 2022 at 4:19 AM Jakob Koschel <jakobkoschel@gmail.com> wrote:
>
> I guess we could apply this to list_for_each_entry() as well
> once all the uses after the loop are fixed?
I think that would be a good longer-term plan. "list_traverse()" ends
up being simpler syntactically, and has a certain level of inherent
type safety (not just the "don't expose the mis-typed head pointer
after the loop").
> I feel like this simply introduces a new set of macros
> (we would also need list_traverse_reverse(), list_traverse_continue_reverse()
> etc) and end up with a second set of macros that do pretty much
> the same as the first one.
I think that if we're happy with this, we can probably do a scripted
conversion. But I do like how it's incremental, in that we wouldn't
necessarily have to do it all in one go.
Because it's always really painful with flag-day interface changes,
which it would be to actually change the semantics of
"list_for_each_entry()" without a name change. It just makes for a lot
of pain for things that aren't in-tree yet (not just drivers that are
out-of-tree in general, but drivers in development etc).
And I really disliked the "pass the type to the list_for_each()"
macro, because of how it made the end result look more complex.
But list_traverse() looks like it would make the end result better
both from a user perspective (ie the code just looks simpler) but also
from the type safety point.
> Personally I guess I also prefer the name list_for_each_entry() over list_traverse()
> and not having two types of iterators for the same thing at the same time.
I absolutely agree with you in theory, and in many ways I like
list_for_each_entry() better as a name too (probably just because I'm
used to it).
But keeping the same name and changing how it works ends up being such
a "everything at once" thing that I don't think it's realistic.
Linus
next prev parent reply other threads:[~2022-03-06 18:57 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 7:58 [PATCH 0/6] list_for_each_entry*: " Xiaomeng Tong
2022-03-01 7:58 ` [PATCH 1/6] Kbuild: compile kernel with gnu11 std Xiaomeng Tong
2022-03-01 17:59 ` kernel test robot
2022-03-01 20:16 ` Linus Torvalds
2022-03-01 20:54 ` Arnd Bergmann
2022-03-01 21:04 ` Linus Torvalds
2022-03-01 21:15 ` Linus Torvalds
2022-03-01 21:43 ` Xiaomeng Tong
2022-03-01 7:58 ` [PATCH 2/6] list: add new MACROs to make iterator invisiable outside the loop Xiaomeng Tong
2022-03-02 2:52 ` kernel test robot
2022-03-02 13:02 ` James Bottomley
2022-03-03 3:31 ` Xiaomeng Tong
2022-03-06 14:33 ` James Bottomley
2022-03-03 20:02 ` Linus Torvalds
2022-03-04 2:51 ` Xiaomeng Tong
2022-03-05 21:09 ` Linus Torvalds
2022-03-06 0:35 ` Linus Torvalds
2022-03-06 12:19 ` Jakob Koschel
2022-03-06 18:57 ` Linus Torvalds [this message]
2022-03-06 14:06 ` Xiaomeng Tong
2022-03-10 23:54 ` [PATCH 2/6] list: add new MACROs to make iterator invisiable Michał Mirosław
2022-03-11 0:46 ` Linus Torvalds
2022-03-12 10:24 ` Michał Mirosław
2022-03-12 21:43 ` Linus Torvalds
2022-03-11 7:15 ` [RFC PATCH] list: test: Add a test for list_traverse David Gow
2022-03-11 14:27 ` [PATCH 2/6] list: add new MACROs to make iterator invisiable outside the loop Daniel Thompson
2022-03-11 18:41 ` Linus Torvalds
2022-03-16 15:45 ` Daniel Thompson
2022-03-01 7:58 ` [PATCH 3/6] kernel: remove iterator use " Xiaomeng Tong
2022-03-01 10:41 ` Greg KH
2022-03-01 11:34 ` Xiaomeng Tong
2022-03-01 11:48 ` Xiaomeng Tong
2022-03-01 7:58 ` [PATCH 4/6] mm: " Xiaomeng Tong
2022-03-01 12:19 ` Xiaomeng Tong
2022-03-01 7:58 ` [PATCH 5/6] net/core: " Xiaomeng Tong
2022-03-01 12:23 ` Xiaomeng Tong
2022-03-01 7:58 ` [PATCH 6/6] drivers/dma: " Xiaomeng Tong
2022-03-01 12:25 ` Xiaomeng Tong
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='CAHk-=whSRNrhxx__Zo5mpKGKZ9BVwCqHCUcfxfBF4VPfFx8edA@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jakobkoschel@gmail.com \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=xiam0nd.tong@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