+ mm-vmacache-hash-addresses-based-on-pmd-fix.patch added to -mm tree

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

 



The patch titled
     Subject: mm, vmacache: hash addresses based on pmd fix
has been added to the -mm tree.  Its filename is
     mm-vmacache-hash-addresses-based-on-pmd-fix.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-vmacache-hash-addresses-based-on-pmd-fix.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-vmacache-hash-addresses-based-on-pmd-fix.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: David Rientjes <rientjes@xxxxxxxxxx>
Subject: mm, vmacache: hash addresses based on pmd fix

- use PMD_SHIFT only if CONFIG_MMU is used, otherwise there is only
  pgdir, per kbuild test robot

- fix vmacache_find_exact() for correct formal name, per me

- only check vma->vm_mm == mm for CONFIG_DEBUG_VM_VMACACHE, per akpm

Tested for {allnoconfig, defconfig} on alpha, arc, arm, arm64, c6x, h8300,
i386, ia64, m68k, microblaze, mips, mips, nds32, nios2, parisc, powerpc,
riscv, s390, sh, sparc, um, and xtensa.

Link: http://lkml.kernel.org/r/alpine.DEB.2.21.1807231532290.109445@xxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/vmacache.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff -puN mm/vmacache.c~mm-vmacache-hash-addresses-based-on-pmd-fix mm/vmacache.c
--- a/mm/vmacache.c~mm-vmacache-hash-addresses-based-on-pmd-fix
+++ a/mm/vmacache.c
@@ -6,12 +6,18 @@
 #include <linux/sched/task.h>
 #include <linux/mm.h>
 #include <linux/vmacache.h>
+#include <asm/pgtable.h>
 
 /*
- * Hash based on the pmd of addr.  Provides a good hit rate for workloads with
- * spatial locality.
+ * Hash based on the pmd of addr if configured with MMU, which provides a good
+ * hit rate for workloads with spatial locality.  Otherwise, use pages.
  */
-#define VMACACHE_HASH(addr) ((addr >> PMD_SHIFT) & VMACACHE_MASK)
+#ifdef CONFIG_MMU
+#define VMACACHE_SHIFT	PMD_SHIFT
+#else
+#define VMACACHE_SHIFT	PAGE_SHIFT
+#endif
+#define VMACACHE_HASH(addr) ((addr >> VMACACHE_SHIFT) & VMACACHE_MASK)
 
 /*
  * Flush vma caches for threads that share a given mm.
@@ -105,8 +111,10 @@ struct vm_area_struct *vmacache_find(str
 		struct vm_area_struct *vma = current->vmacache.vmas[idx];
 
 		if (vma) {
+#ifdef CONFIG_DEBUG_VM_VMACACHE
 			if (WARN_ON_ONCE(vma->vm_mm != mm))
 				break;
+#endif
 			if (vma->vm_start <= addr && vma->vm_end > addr) {
 				count_vm_vmacache_event(VMACACHE_FIND_HITS);
 				return vma;
@@ -124,7 +132,7 @@ struct vm_area_struct *vmacache_find_exa
 					   unsigned long start,
 					   unsigned long end)
 {
-	int idx = VMACACHE_HASH(addr);
+	int idx = VMACACHE_HASH(start);
 	int i;
 
 	count_vm_vmacache_event(VMACACHE_FIND_CALLS);
_

Patches currently in -mm which might be from rientjes@xxxxxxxxxx are

mm-vmacache-hash-addresses-based-on-pmd.patch
mm-vmacache-hash-addresses-based-on-pmd-fix.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux