public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Meng Tang <tangmeng@uniontech.com>,
	Peng Zhang <zhangpeng362@huawei.com>,
	Joel Granados <j.granados@samsung.com>
Cc: keescook@chromium.org, yzaikin@google.com, ebiederm@xmission.com,
	willy@infradead.org, kbuild-all@lists.01.org,
	nixiaoming@huawei.com, nizhen@uniontech.com,
	zhanglianjie@uniontech.com, sujiaxun@uniontech.com,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v5 1/2] fs/proc: optimize register ctl_tables
Date: Wed, 1 Mar 2023 17:12:39 -0800	[thread overview]
Message-ID: <Y//4B2Bw4O2umKgW@bombadil.infradead.org> (raw)
In-Reply-To: <Y8iKjJYMFRSthxzn@bombadil.infradead.org>

On Wed, Jan 18, 2023 at 04:10:52PM -0800, Luis Chamberlain wrote:
> On Mon, Jan 09, 2023 at 10:00:49AM -0800, Luis Chamberlain wrote:
> > On Tue, Mar 08, 2022 at 07:22:51PM +0800, kernel test robot wrote:
> > > Hi Meng,
> > > 
> > > Thank you for the patch! Perhaps something to improve:
> > 
> > Meng, can you re-send with a fix? We're early in the merge window to
> > help test stuff now.
> 
> *re-poke* if you can't work on this please let me know!

I've taken the time to rebase this but I'm not a big fan of how fragile
it is, you can easily forget to do the proper accounting or bailing out.

Upon looking at all this it reminded me tons of times Eric has
said a few calls are just compatibility wrappers, and otherwise they are
deprecated. Ie, they exist just to old users but we should have new
users move on to the new helpers. When / if we can move the older ones
away that'd be great. Knowing that simplifies the use-cases we have to
address for this case too.

So I phased out completely register_sysctl_paths() and then started to
work on register_sysctl_table(). I didn't complete phasing out
register_sysctl_table() but with a bit of patience and looking at the
few last examples I did I think we can quickly phase it out with coccinelle.
Here's where I'm at:

https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=sysctl-testing

On top of that I've rebased your patches but I'm not confident in them
so I just put this out here in case others want to work on it:

https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=sysctl-testing-opt

What I think we should do first instead is do a non-functional change
which transforms all loops to list_for_each_table_entry() and then 
we can consider using the bail out *within* the list_for_each_table_entry()
macro itself.

That would solve the first part -- the fragile odd checks to bail out
early.  But not the odd accounting we have to do at times. So it begs
the question if we can instead deprecate register_sysctl_table() and
then have a counter for us at all times. Also maybe an even simpler
alternative may just be to see to have the nr_entries be inferred with
ARRAY_SIZE() if count_subheaders() == 1? I haven't looked into that yet.

  Luis

  reply	other threads:[~2023-03-02  1:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 11:23 [PATCH v5 1/2] fs/proc: optimize register ctl_tables Meng Tang
2022-03-04 11:23 ` [PATCH v5 2/2] fs/proc: sysctl: remove register ctl_table end with empty Meng Tang
2022-03-08 11:22 ` [PATCH v5 1/2] fs/proc: optimize register ctl_tables kernel test robot
2023-01-09 18:00   ` Luis Chamberlain
2023-01-19  0:10     ` Luis Chamberlain
2023-03-02  1:12       ` Luis Chamberlain [this message]
2023-03-02  2:45         ` Meng Tang
2023-03-02 19:52           ` Luis Chamberlain
2023-03-02  2:56         ` Meng Tang

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=Y//4B2Bw4O2umKgW@bombadil.infradead.org \
    --to=mcgrof@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=j.granados@samsung.com \
    --cc=kbuild-all@lists.01.org \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nixiaoming@huawei.com \
    --cc=nizhen@uniontech.com \
    --cc=sujiaxun@uniontech.com \
    --cc=tangmeng@uniontech.com \
    --cc=willy@infradead.org \
    --cc=yzaikin@google.com \
    --cc=zhanglianjie@uniontech.com \
    --cc=zhangpeng362@huawei.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