From: Al Viro <viro@ZenIV.linux.org.uk>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] fs/seq_file: remove kmalloc(ops) for single_open seqfiles
Date: Fri, 20 Jul 2018 12:15:09 +0100 [thread overview]
Message-ID: <20180720111509.GB30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180720102952.30935-1-vbabka@suse.cz>
On Fri, Jul 20, 2018 at 12:29:52PM +0200, Vlastimil Babka wrote:
> single_open() currently allocates seq_operations with kmalloc(). This is
> suboptimal, because that's four pointers, of which three are constant, and
> only the 'show' op differs. We also have to be careful to use single_release()
> to avoid leaking the ops structure.
>
> Instead of this we can have a fixed single_show() function and constant ops
> structure for these seq_files. We can store the pointer to the 'show' op as
> a new field of struct seq_file. That's also not terribly elegant, because the
> field is there also for non-single_open() seq files, but it's a single pointer
> in an already existing (and already relatively large) structure instead of
> an extra kmalloc of four pointers, so the tradeoff is OK.
... except that piling indirect calls is costly and ->show() is called a lot more
than open() is.
prev parent reply other threads:[~2018-07-20 11:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 10:29 Vlastimil Babka
2018-07-20 11:15 ` Al Viro [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=20180720111509.GB30522@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/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