On Thu, Apr 23, 2020 at 1:06 PM Jeffle Xu <jefflexu@xxxxxxxxxxxxxxxxx> wrote: > > Since the stacking of regular file operations [1], the overlayfs > edition of write_iter() is called when writing regular files. > > Since then, xattr lookup is needed on every write since file_remove_privs() > is called from ovl_write_iter(), which would become the performance > bottleneck when writing small chunks of data. In my test case, > file_remove_privs() would consume ~15% CPU when running fstime of > unixbench (the workload is repeadly writing 1 KB to the same file) [2]. > > Inherit the SB_NOSEC flag from upperdir. Yes, I think this is safe if we assume no changes to the upper while it is part of overlay; which is a documented assumption. Once we relax that no-change rule things become tricky, since it's difficult to propagate the removal of S_NOSEC on upper to the overlay... > Since then xattr lookup would be > done only once on the first write. Unixbench fstime gets a ~20% performance > gain with this patch. I'll apply this, with an additional comment on the effect of changes to upper. Thanks, Miklos