Re: [PATCH 3/3] mincore: Introduce the MINCORE_SWAP bit

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

 



Pavel Emelyanov wrote:
When a page is swapped out it should be included in the memory dump,
but the existing mincore() doesn't report the set bit for such pages.

Thus add a bit for swapped out pages.

We can reuse ANON bit there.
Plus you forget to handle migration-entries, they can be both file and anon too.


Signed-off-by: Pavel Emelyanov<xemul@xxxxxxxxxxxxx>

---
  include/linux/mman.h |    1 +
  mm/mincore.c         |    2 +-
  2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/mman.h b/include/linux/mman.h
index 9d1de16..bfe4038 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -12,6 +12,7 @@

  #define MINCORE_RESIDENT	0x1
  #define MINCORE_ANON		0x2
+#define MINCORE_SWAP		0x4

  #ifdef __KERNEL__
  #include<linux/mm.h>
diff --git a/mm/mincore.c b/mm/mincore.c
index 3163dfb..82c5c3e 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -146,7 +146,7 @@ static void mincore_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
  			} else {
  #ifdef CONFIG_SWAP
  				pgoff = entry.val;
-				*vec = mincore_page(&swapper_space, pgoff);
+				*vec = mincore_page(&swapper_space, pgoff) | MINCORE_SWAP;
  #else
  				WARN_ON(1);
  				*vec = MINCORE_RESIDENT;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  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@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]