From: "libaokun (A)" <libaokun1@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
<oliver.sang@intel.com>, <beibei.si@intel.com>,
<jannh@google.com>, <mszeredi@redhat.com>,
<torvalds@linux-foundation.org>, <yukuai3@huawei.com>,
Baokun Li <libaokun1@huawei.com>
Subject: Re: [PATCH 5.10] fget: clarify and improve __fget_files() implementation
Date: Fri, 18 Feb 2022 09:27:38 +0800 [thread overview]
Message-ID: <f39e907b-203b-ded4-e0e5-0d89cd7eb3f6@huawei.com> (raw)
In-Reply-To: <Yg6aLQCR3zxn5XoW@kroah.com>
在 2022/2/18 2:55, Greg KH 写道:
> On Tue, Feb 15, 2022 at 02:51:07PM +0800, Baokun Li wrote:
>> From: Linus Torvalds <torvalds@linux-foundation.org>
>>
>> commit e386dfc56f837da66d00a078e5314bc8382fab83 upstream.
>>
>> Commit 054aa8d439b9 ("fget: check that the fd still exists after getting
>> a ref to it") fixed a race with getting a reference to a file just as it
>> was being closed. It was a fairly minimal patch, and I didn't think
>> re-checking the file pointer lookup would be a measurable overhead,
>> since it was all right there and cached.
>>
>> But I was wrong, as pointed out by the kernel test robot.
>>
>> The 'poll2' case of the will-it-scale.per_thread_ops benchmark regressed
>> quite noticeably. Admittedly it seems to be a very artificial test:
>> doing "poll()" system calls on regular files in a very tight loop in
>> multiple threads.
>>
>> That means that basically all the time is spent just looking up file
>> descriptors without ever doing anything useful with them (not that doing
>> 'poll()' on a regular file is useful to begin with). And as a result it
>> shows the extra "re-check fd" cost as a sore thumb.
>>
>> Happily, the regression is fixable by just writing the code to loook up
>> the fd to be better and clearer. There's still a cost to verify the
>> file pointer, but now it's basically in the noise even for that
>> benchmark that does nothing else - and the code is more understandable
>> and has better comments too.
>>
>> [ Side note: this patch is also a classic case of one that looks very
>> messy with the default greedy Myers diff - it's much more legible with
>> either the patience of histogram diff algorithm ]
>>
>> Link: https://lore.kernel.org/lkml/20211210053743.GA36420@xsang-OptiPlex-9020/
>> Link: https://lore.kernel.org/lkml/20211213083154.GA20853@linux.intel.com/
>> Reported-by: kernel test robot <oliver.sang@intel.com>
>> Tested-by: Carel Si <beibei.si@intel.com>
>> Cc: Jann Horn <jannh@google.com>
>> Cc: Miklos Szeredi <mszeredi@redhat.com>
>> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
>> Signed-off-by: Baokun Li <libaokun1@huawei.com>
>> ---
>> fs/file.c | 72 ++++++++++++++++++++++++++++++++++++++++++-------------
>> 1 file changed, 56 insertions(+), 16 deletions(-)
> Now queued up, thanks.
Thanks!
>
> Any chance you can do this for 5.4 and older kernels too?
It's my pleasure. I'll sync this patch to 5.4, 4.19, 4.14, 4.9, 4.4.
>
> greg k-h
> .
--
With Best Regards,
Baokun Li
.
prev parent reply other threads:[~2022-02-18 1:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 6:51 Baokun Li
2022-02-17 18:55 ` Greg KH
2022-02-18 1:27 ` libaokun (A) [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=f39e907b-203b-ded4-e0e5-0d89cd7eb3f6@huawei.com \
--to=libaokun1@huawei.com \
--cc=beibei.si@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mszeredi@redhat.com \
--cc=oliver.sang@intel.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yukuai3@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
all inboxes | Powered by JetHome®