mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: linux-kernel@vger.kernel.org
Cc: x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
	Ingo Molnar <mingo@kernel.org>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: [POC 12/12] fs/dcache.c: use rai_bucket_shift for dentry hashtable
Date: Thu, 18 Oct 2018 00:33:32 +0200	[thread overview]
Message-ID: <20181017223332.11964-12-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <20181017223332.11964-1-linux@rasmusvillemoes.dk>

Before this, the disassembly of __d_lookup_rcu begins

   0x2d10 <__d_lookup_rcu>:     push   %r15
   0x2d12 <__d_lookup_rcu+2>:   push   %r14
   0x2d14 <__d_lookup_rcu+4>:   push   %r13
   0x2d16 <__d_lookup_rcu+6>:   push   %r12
   0x2d18 <__d_lookup_rcu+8>:   push   %rbp
   0x2d19 <__d_lookup_rcu+9>:   push   %rbx
   0x2d1a <__d_lookup_rcu+10>:  sub    $0x18,%rsp
   0x2d1e <__d_lookup_rcu+14>:  mov    (%rsi),%r12
   0x2d21 <__d_lookup_rcu+17>:  mov    0x0(%rip),%ecx        # 0x2d27 <__d_lookup_rcu+23>
   0x2d27 <__d_lookup_rcu+23>:  mov    0x8(%rsi),%r13
   0x2d2b <__d_lookup_rcu+27>:  mov    %r12d,%eax
   0x2d2e <__d_lookup_rcu+30>:  shr    %cl,%eax
   0x2d30 <__d_lookup_rcu+32>:  mov    0x0(%rip),%rcx        # 0x2d37 <__d_lookup_rcu+39>
   0x2d37 <__d_lookup_rcu+39>:  lea    (%rcx,%rax,8),%rax
   0x2d3b <__d_lookup_rcu+43>:  mov    (%rax),%rbx
   0x2d3e <__d_lookup_rcu+46>:  and    $0xfffffffffffffffe,%rbx
   0x2d42 <__d_lookup_rcu+50>:  je     0x2df3 <__d_lookup_rcu+227>
   0x2d48 <__d_lookup_rcu+56>:  mov    %r12,%rax
   0x2d4b <__d_lookup_rcu+59>:  mov    %r12d,%r10d
   0x2d4e <__d_lookup_rcu+62>:  mov    %rdx,%r15

After this, and after the patching of the run-time values of
dentry_hashtable and d_hash_shift, gdb on /proc/kcore says that we now
have

   0xffffffff8902e8d0:  push   %r15
   0xffffffff8902e8d2:  push   %r14
   0xffffffff8902e8d4:  push   %r13
   0xffffffff8902e8d6:  push   %r12
   0xffffffff8902e8d8:  push   %rbp
   0xffffffff8902e8d9:  push   %rbx
   0xffffffff8902e8da:  sub    $0x18,%rsp
   0xffffffff8902e8de:  mov    (%rsi),%r12
   0xffffffff8902e8e1:  mov    0x8(%rsi),%r13
   0xffffffff8902e8e5:  mov    %r12d,%eax
   0xffffffff8902e8e8:  movabs $0xffff959b80007000,%rcx
   0xffffffff8902e8f2:  shr    $0x12,%eax
   0xffffffff8902e8f5:  lea    (%rcx,%rax,8),%rcx
   0xffffffff8902e8f9:  mov    (%rcx),%rbx
   0xffffffff8902e8fc:  and    $0xfffffffffffffffe,%rbx
   0xffffffff8902e900:  je     0xffffffff8902e9b1
   0xffffffff8902e906:  mov    %r12,%rax
   0xffffffff8902e909:  mov    %r12d,%r10d
   0xffffffff8902e90c:  mov    %rdx,%r15

The shr $0x12, %eax is consistent with

[    0.300676] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)

and nothing seems to explode.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 fs/dcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 1d54dfb38c9d..226298c3a599 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -100,7 +100,7 @@ static struct hlist_bl_head *dentry_hashtable __read_mostly;
 
 static inline struct hlist_bl_head *d_hash(unsigned int hash)
 {
-	return dentry_hashtable + (hash >> d_hash_shift);
+	return rai_bucket_shift(dentry_hashtable, d_hash_shift, hash);
 }
 
 #define IN_LOOKUP_SHIFT 10
-- 
2.19.1.6.gbde171bbf5


      parent reply	other threads:[~2018-10-17 22:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 22:33 [POC 01/12] Accessing __ro_after_init variables as immediates Rasmus Villemoes
2018-10-17 22:33 ` [POC 02/12] init/main.c: call update_rai_access() Rasmus Villemoes
2018-10-17 22:33 ` [POC 03/12] arch/Kconfig: add ARCH_HAS_RAI symbol Rasmus Villemoes
2018-10-17 22:33 ` [POC 04/12] vmlinux.lds.h: handle various rai sections Rasmus Villemoes
2018-10-17 22:33 ` [POC 05/12] x86-64: initial ro-after-init patching support Rasmus Villemoes
2018-10-17 22:33 ` [POC 06/12] ugly ugly hack Rasmus Villemoes
2018-10-17 22:33 ` [POC 07/12] x86-64: rai: implement _rai_load Rasmus Villemoes
2018-10-17 22:33 ` [POC 08/12] fs/dcache.c: access dentry_cache via rai_load Rasmus Villemoes
2018-10-17 22:33 ` [POC 09/12] fs/inode.c: access inode_cachep " Rasmus Villemoes
2018-10-17 22:33 ` [POC 10/12] hack: /proc/rai: add rai_bucket_shift use Rasmus Villemoes
2018-10-17 22:33 ` [POC 11/12] x86-64: implement _rai_bucket_shift Rasmus Villemoes
2018-10-17 22:33 ` Rasmus Villemoes [this message]

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=20181017223332.11964-12-linux@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®