Re: [PATCH] fs/seq_file: remove kmalloc(ops) for single_open seqfiles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux