From: Luis Chamberlain <mcgrof@kernel.org>
To: tangmeng <tangmeng@uniontech.com>
Cc: Matthew Wilcox <willy@infradead.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
keescook@chromium.org, yzaikin@google.com, 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] fs/proc: optimize exactly register one ctl_table
Date: Mon, 28 Feb 2022 07:09:00 -0800 [thread overview]
Message-ID: <YhzljEnznlZjw53K@bombadil.infradead.org> (raw)
In-Reply-To: <f8820396-ff02-7589-a2f0-be542fbc2c3d@uniontech.com>
On Mon, Feb 28, 2022 at 10:42:19AM +0800, tangmeng wrote:
>
>
> On 2022/2/28 05:26, Luis Chamberlain wrote:
>
> >
> > This effort is trying to save space. But now you are adding a new bool
> > for every single struct ctl_table.... So doesn't the math work out
> > against us if you do a build size comparison?
> >
> Currently,
You mean after your patch.
> the definition of the ctl_table structure and the size of the
> members are as follows.
> /* In 64-bit system*/
> struct ctl_table {
...
> bool register_one; /* 1 bytes */
...
> } __randomize_layout;
>
> Before
Before it the bool was not there. How can it be you are not increasing
the size?
> > Can you just instead add a new helper which deals with one entry?
> > Perhaps then make the other caller which loops use that? That way
> > we don't bloat the kernel with an extra bool per ctl_table?
> >
> I have considered add a new helper which deals with one entry. But
> considered that the code will be similar to array,
That's fine, if we have tons of these.
> > Or can you add a new parameter which specififes the size of the array?
> >
> When I considered add a new parameter which specififes the size of the
> array. I have encountered the following difficulties.
>
> The current status is that during the ctl_table registration process, the
> method of traversing the table is implemented by a movement of the pointer
> entry pointing to the struct ctl_table. When entry->procname is empty, it
> considers table traversal.
>
> This leads to that when the ctl_tables have child tables in the table, it is
> not possible to get the child table's size by ARRAY_SIZE(*entry), so
> transmitting the Child Table Size becomes very difficult.
I see.
A simple routine for dealing with single entries might be best then.
And while at it, see if you can add a DECLARE_SYSCTL_SINGLE or something
which will wrap up all the ugly stuff.
Luis
prev parent reply other threads:[~2022-02-28 15:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 9:32 [PATCH] fs/proc: optimize exactly register one ctl_table Meng Tang
2022-02-27 21:26 ` Luis Chamberlain
[not found] ` <f8820396-ff02-7589-a2f0-be542fbc2c3d@uniontech.com>
2022-02-28 15:09 ` Luis Chamberlain [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=YhzljEnznlZjw53K@bombadil.infradead.org \
--to=mcgrof@kernel.org \
--cc=ebiederm@xmission.com \
--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 \
/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).