+ proc-kcore-optimize-multiple-page-reads.patch added to -mm tree

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

 



The patch titled
     Subject: proc/kcore: optimize multiple page reads
has been added to the -mm tree.  Its filename is
     proc-kcore-optimize-multiple-page-reads.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/proc-kcore-optimize-multiple-page-reads.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/proc-kcore-optimize-multiple-page-reads.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: Omar Sandoval <osandov@xxxxxx>
Subject: proc/kcore: optimize multiple page reads

The current code does a full search of the segment list every time for
every page.  This is wasteful, since it's almost certain that the next
page will be in the same segment.  Instead, check if the previous segment
covers the current page before doing the list search.

Link: http://lkml.kernel.org/r/296622acfe01efc2e93472b312afe9e374370abe.1531440458.git.osandov@xxxxxx
Signed-off-by: Omar Sandoval <osandov@xxxxxx>
Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Cc: Bhupesh Sharma <bhsharma@xxxxxxxxxx>
Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx>
Cc: James Morse <james.morse@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---


diff -puN fs/proc/kcore.c~proc-kcore-optimize-multiple-page-reads fs/proc/kcore.c
--- a/fs/proc/kcore.c~proc-kcore-optimize-multiple-page-reads
+++ a/fs/proc/kcore.c
@@ -428,10 +428,18 @@ read_kcore(struct file *file, char __use
 	if ((tsz = (PAGE_SIZE - (start & ~PAGE_MASK))) > buflen)
 		tsz = buflen;
 
+	m = NULL;
 	while (buflen) {
-		list_for_each_entry(m, &kclist_head, list) {
-			if (start >= m->addr && start < (m->addr+m->size))
-				break;
+		/*
+		 * If this is the first iteration or the address is not within
+		 * the previous entry, search for a matching entry.
+		 */
+		if (!m || start < m->addr || start >= m->addr + m->size) {
+			list_for_each_entry(m, &kclist_head, list) {
+				if (start >= m->addr &&
+				    start < m->addr + m->size)
+					break;
+			}
 		}
 
 		if (&m->list == &kclist_head) {
_

Patches currently in -mm which might be from osandov@xxxxxx are

proc-kcore-dont-grab-lock-for-kclist_add.patch
proc-kcore-replace-kclist_lock-rwlock-with-rwsem.patch
proc-kcore-fix-memory-hotplug-vs-multiple-opens-race.patch
proc-kcore-hold-lock-during-read.patch
proc-kcore-clean-up-elf-header-generation.patch
proc-kcore-optimize-multiple-page-reads.patch
proc-kcore-add-vmcoreinfo-note-to-proc-kcore.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