All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH][RFC] %pd - for printing dentry name
Date: Thu, 4 Feb 2010 09:13:18 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1002040848330.3707@localhost.localdomain> (raw)
In-Reply-To: <20100204160206.GG6676@linux.vnet.ibm.com>



On Thu, 4 Feb 2010, Paul E. McKenney wrote:
> 
> Ah, good point on the hash size.  And given that DNAME_INLINE_LEN_MIN
> is 40 characters on 32-bit systems and 32 characters on 64-bit systems,
> I agree that while a four-character increase might be nice, it cannot be
> said to be an emergency.

Well, what we _could_ do is to make the 'length' field be part of the name 
itself, and just keep the hash separate. The hash (and parenthood) is what 
we check most in the hot inner loop, and don't want to have any extra 
indirection (or cache misses) for. The name length we check only later, 
after we've done all other checks (and after we've gotten the spinlock, 
which is the big thing).

So qstr->len is _not_ performance critical in the same way that qstr->hash 
is.

So we might not save 4 bytes, but we _could_ try to move the length field 
into the name with something like

	struct qstr_name {
		unsigned short len;
		char name[];
	};

	struct qstr {
		unsigned int hash;
		const struct qstr_name *name;
	};

but the problem then is one of alignment (ie that pointer generally wants 
8-byte alignment on 64-bit architectures, so none of this _helps_ unless 
we also move some other 4-byte field into the qstr (we could look at 
making 'd_time' be a 32-bit entry, for example, and move it in there).

Or we could do really crazy things, and put the four first characters of 
d_iname inside the qstr etc etc. It's just that it all gets totally 
unnatural very quickly.

So 'struct dentry' is one of the most important data structures we have 
(just because you easily end up with millions of them), but since we 
already control its size by varying the inline name length, I doubt that 
playing really fancy games is worth it.

			Linus

  reply	other threads:[~2010-02-04 17:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 22:25 [PATCH][RFC] %pd - for printing dentry name Al Viro
2010-02-01 22:34 ` Al Viro
2010-02-01 22:37 ` Linus Torvalds
2010-02-01 23:18   ` Al Viro
2010-02-02  1:06     ` Al Viro
2010-02-02  5:55       ` Eric W. Biederman
2010-02-02 17:01         ` Al Viro
2010-02-02 18:10           ` Olivier Galibert
2010-02-02 19:19           ` Eric W. Biederman
2010-02-03  3:04             ` Al Viro
2010-02-04  4:53               ` Al Viro
2010-02-02  4:22     ` Linus Torvalds
2010-02-02  5:00       ` Al Viro
2010-02-02  6:36         ` Nick Piggin
2010-02-04  6:02           ` Al Viro
2010-02-04  7:40             ` Nick Piggin
2010-02-02  6:53     ` Paul E. McKenney
2010-02-02  7:09       ` Al Viro
2010-02-02 13:32         ` Matthew Wilcox
2010-02-02 15:56           ` Linus Torvalds
2010-02-02 16:13             ` Matthew Wilcox
2010-02-02 16:43           ` Al Viro
2010-02-03 10:52         ` Paul E. McKenney
2010-02-03  2:49       ` Paul E. McKenney
2010-02-04 15:29         ` Linus Torvalds
2010-02-04 16:02           ` Paul E. McKenney
2010-02-04 17:13             ` Linus Torvalds [this message]
2010-02-04 17:36               ` Al Viro
2010-02-07 16:34                 ` Paul E. McKenney
2010-02-01 22:45 ` Joe Perches

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=alpine.LFD.2.00.1002040848330.3707@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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.