linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: Linux MM <linux-mm@kvack.org>, Hugh Dickins <hughd@google.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Subject: [PATCH 1/3] mincore: Introduce named constant for existing bit
Date: Mon, 26 Dec 2011 00:45:57 +0400	[thread overview]
Message-ID: <4EF78B85.6070909@parallels.com> (raw)
In-Reply-To: <4EF78B6A.8020904@parallels.com>


Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---
 include/linux/mman.h |    2 ++
 mm/huge_memory.c     |    2 +-
 mm/mincore.c         |   10 +++++-----
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/linux/mman.h b/include/linux/mman.h
index 8b74e9b..e4fda1e 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -10,6 +10,8 @@
 #define OVERCOMMIT_ALWAYS		1
 #define OVERCOMMIT_NEVER		2
 
+#define MINCORE_RESIDENT	0x1
+
 #ifdef __KERNEL__
 #include <linux/mm.h>
 #include <linux/percpu_counter.h>
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 36b3d98..4f87067 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1045,7 +1045,7 @@ int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
 			 * All logical pages in the range are present
 			 * if backed by a huge page.
 			 */
-			memset(vec, 1, (end - addr) >> PAGE_SHIFT);
+			memset(vec, MINCORE_RESIDENT, (end - addr) >> PAGE_SHIFT);
 		}
 	} else
 		spin_unlock(&vma->vm_mm->page_table_lock);
diff --git a/mm/mincore.c b/mm/mincore.c
index 636a868..b719cdd 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -38,7 +38,7 @@ static void mincore_hugetlb_page_range(struct vm_area_struct *vma,
 				       addr & huge_page_mask(h));
 		present = ptep && !huge_pte_none(huge_ptep_get(ptep));
 		while (1) {
-			*vec = present;
+			*vec = (present ? MINCORE_RESIDENT : 0);
 			vec++;
 			addr += PAGE_SIZE;
 			if (addr == end)
@@ -83,7 +83,7 @@ static unsigned char mincore_page(struct address_space *mapping, pgoff_t pgoff)
 		page_cache_release(page);
 	}
 
-	return present;
+	return present ? MINCORE_RESIDENT : 0;
 }
 
 static void mincore_unmapped_range(struct vm_area_struct *vma,
@@ -122,7 +122,7 @@ static void mincore_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
 		if (pte_none(pte))
 			mincore_unmapped_range(vma, addr, next, vec);
 		else if (pte_present(pte))
-			*vec = 1;
+			*vec = MINCORE_RESIDENT;
 		else if (pte_file(pte)) {
 			pgoff = pte_to_pgoff(pte);
 			*vec = mincore_page(vma->vm_file->f_mapping, pgoff);
@@ -131,14 +131,14 @@ static void mincore_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
 
 			if (is_migration_entry(entry)) {
 				/* migration entries are always uptodate */
-				*vec = 1;
+				*vec = MINCORE_RESIDENT;
 			} else {
 #ifdef CONFIG_SWAP
 				pgoff = entry.val;
 				*vec = mincore_page(&swapper_space, pgoff);
 #else
 				WARN_ON(1);
-				*vec = 1;
+				*vec = MINCORE_RESIDENT;
 #endif
 			}
 		}
-- 
1.5.5.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-12-25 20:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-25 20:45 [RFC][PATCH 0/3] Extend the mincore() report bits Pavel Emelyanov
2011-12-25 20:45 ` Pavel Emelyanov [this message]
2011-12-25 20:46 ` [PATCH 2/3] mincore: Introduce the MINCORE_ANON bit Pavel Emelyanov
2011-12-26  0:05   ` KOSAKI Motohiro
2011-12-26 16:07     ` Pavel Emelyanov
2011-12-26 16:35       ` KOSAKI Motohiro
2011-12-26 16:49         ` Pavel Emelyanov
2011-12-27 22:53           ` KOSAKI Motohiro
2011-12-25 20:46 ` [PATCH 3/3] mincore: Introduce the MINCORE_SWAP bit Pavel Emelyanov
2011-12-26  8:08   ` Konstantin Khlebnikov

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=4EF78B85.6070909@parallels.com \
    --to=xemul@parallels.com \
    --cc=aarcange@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.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