Re: [PATCH 4.9 0/1] selinux: drop super_block backpointer from superblock_security_struct

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

 



On 11.08.22 12:21, Greg KH wrote:
> On Thu, Aug 11, 2022 at 11:46:09AM +0200, Alexander Grund wrote:
>> I mean this patch removes a superflous pointer of the superblock struct
>> making the kernel use less memory.
> 
> Also, how much measurable memory does this save?  You did not quantify
> it.

It saves one pointer, i.e. usually 8 Byte, per superblock when using SELinux.

I don't know how many of those superblocks will be allocated in total on usual systems
as I'm not familiar with the details of the filesystems.
However following one callchain leads to

> /*
> * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that
> * will never be mountable)
> */
> struct dentry *mount_pseudo_xattr(struct file_system_type *fs_type, char *name,

So it seems one superblock even for each pseudo-fs of which there can be many.

A quick experiment [1] on my phone shows about 300 superblocks allocated which means
that the patch saves a bit over 2kB of memory.
So not that much on usual systems but could be much for some embedded systems.

I hope that helps,
Alex

[1] For the experiment I added a debug counter to `superblock_alloc_security`



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux