All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Amir Goldstein <amir73il@gmail.com>
Subject: Re: [GIT PULL] Fsnotify cleanups
Date: Fri, 8 Jun 2018 13:34:04 -0700	[thread overview]
Message-ID: <CA+55aFyhzE_g8zemF4qyb_Y33=9YLV7_Hy6ASVyJPO8mFh3QSA@mail.gmail.com> (raw)
In-Reply-To: <20180608132737.etbkpqg77yz3vhp7@quack2.suse.cz>

On Fri, Jun 8, 2018 at 6:27 AM Jan Kara <jack@suse.cz> wrote:
>
> The alignment could be fixed by having
>
> struct inode {
>         ...
>         struct fsnotify_obj i_fsnotify __attribute__ ((aligned(sizeof(void *))));
>         ...
> }
>
> but that's too ugly even for my twisted taste. And before someone asks,
> adding aligned attribute to the definition of fsnotify_obj structure makes
> it grow the padding at the end again.

Yeah, I don't think there's any way to say "this can't be an array
member, don't pad the size out to the alignment".

I do wonder if perhaps "struct fsnotify_obj" could actually have a
mask and a 32-bit object ID instead, which would (a) avoid the
alignment issue and (b) actually shrink the structure onm 64-bit.

Obviously you'd then have to look up the pointer from the object ID
(presumably using a hash, but maybe it would use the radix tree of
idr_alloc() or something).

I haven't looked at how often those pointers actually get looked up.
If the 'mask' makes it fairly rare, then the extra indirection might
be ok. I suspect it's not. But I thought I'd mention it as a possible
approach.

The other approach is - as you say - to move 'mask' to be behind the
pointer. But if that causes a lot of extra pointer chasing that mask
would normally avoid, that could be really expensive too. We see that
with the security objects: the cost of looking up whatever is behind
i_security is really nasty, because every inode gets allocated a
private security structure, so it's absolutely horrendous for cache
effects (no sharing).

But I suspect that the behavior of i_fsnotify_marks is very different
from i_security, in that most inodes probably don't have marks at all.
No? Yes? So you might not have the nasty case of "almost all inode
access ends up following that pointer and it's horrible in the cache".

                  Linus

  reply	other threads:[~2018-06-08 20:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 15:02 [GIT PULL] Fsnotify cleanups Jan Kara
2018-06-07 16:34 ` Linus Torvalds
2018-06-08 13:27   ` Jan Kara
2018-06-08 20:34     ` Linus Torvalds [this message]
2018-06-09  6:57       ` Amir Goldstein
2018-06-09  8:00         ` Amir Goldstein
2018-06-11 16:12           ` Jan Kara
2018-06-11 16:31             ` Amir Goldstein
2018-06-09 17:30         ` Linus Torvalds
2018-06-09 18:46           ` Amir Goldstein
2018-06-10 17:49             ` Amir Goldstein
2018-06-11 13:36               ` Jan Kara
2018-06-11 13:58                 ` Amir Goldstein
2018-06-11 16:03                   ` Jan Kara
2018-06-11 16:38                     ` Amir Goldstein
2018-06-11 19:51                       ` Amir Goldstein
2018-06-13 13:21                         ` Jan Kara
2018-06-13 13:56                           ` Amir Goldstein
2018-06-13 22:17                             ` Amir Goldstein
2018-06-22 16:44                               ` Jan Kara
2018-06-23  7:42                                 ` Amir Goldstein
2018-06-11 11:08       ` Jan Kara

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='CA+55aFyhzE_g8zemF4qyb_Y33=9YLV7_Hy6ASVyJPO8mFh3QSA@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.