[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180720111509.GB30522@ZenIV.linux.org.uk>
Date: Fri, 20 Jul 2018 12:15:09 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH] fs/seq_file: remove kmalloc(ops) for single_open seqfiles
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.
Powered by blists - more mailing lists