linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: kosaki.motohiro@jp.fujitsu.com, minchan.kim@gmail.com
Cc: dhowells@redhat.com, akpm@linux-foundation.org,
	torvalds@linux-foundation.org, peterz@infradead.org,
	nrik.Berkhan@ge.com, uclinux-dev@uclinux.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	hannes@cmpxchg.org, riel@surriel.com, lee.schermerhorn@hp.com
Subject: [PATCH 1/2] NOMMU: There is no mlock() for NOMMU, so don't provide the bits
Date: Fri, 13 Mar 2009 17:33:48 +0000	[thread overview]
Message-ID: <20090313173348.10169.31420.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20090313173343.10169.58053.stgit@warthog.procyon.org.uk>

The mlock() facility does not exist for NOMMU since all mappings are
effectively locked anyway, so we don't make the bits available when they're
not useful.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/page-flags.h |   20 +++++++++++++-------
 mm/Kconfig                 |    8 ++++++++
 mm/internal.h              |    8 +++++---
 3 files changed, 26 insertions(+), 10 deletions(-)


diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 219a523..61df177 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -96,6 +96,8 @@ enum pageflags {
 	PG_swapbacked,		/* Page is backed by RAM/swap */
 #ifdef CONFIG_UNEVICTABLE_LRU
 	PG_unevictable,		/* Page is "unevictable"  */
+#endif
+#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
 	PG_mlocked,		/* Page is vma mlocked */
 #endif
 #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
@@ -234,20 +236,20 @@ PAGEFLAG_FALSE(SwapCache)
 #ifdef CONFIG_UNEVICTABLE_LRU
 PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
 	TESTCLEARFLAG(Unevictable, unevictable)
+#else
+PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
+	SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
+	__CLEARPAGEFLAG_NOOP(Unevictable)
+#endif
 
+#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
 #define MLOCK_PAGES 1
 PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
 	TESTSCFLAG(Mlocked, mlocked)
-
 #else
-
 #define MLOCK_PAGES 0
 PAGEFLAG_FALSE(Mlocked)
 	SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked)
-
-PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
-	SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
-	__CLEARPAGEFLAG_NOOP(Unevictable)
 #endif
 
 #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
@@ -367,9 +369,13 @@ static inline void __ClearPageTail(struct page *page)
 
 #ifdef CONFIG_UNEVICTABLE_LRU
 #define __PG_UNEVICTABLE	(1 << PG_unevictable)
-#define __PG_MLOCKED		(1 << PG_mlocked)
 #else
 #define __PG_UNEVICTABLE	0
+#endif
+
+#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
+#define __PG_MLOCKED		(1 << PG_mlocked)
+#else
 #define __PG_MLOCKED		0
 #endif
 
diff --git a/mm/Kconfig b/mm/Kconfig
index a5b7781..8c89597 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -214,5 +214,13 @@ config UNEVICTABLE_LRU
 	  will use one page flag and increase the code size a little,
 	  say Y unless you know what you are doing.
 
+config HAVE_MLOCK
+	bool
+	default y if MMU=y
+
+config HAVE_MLOCKED_PAGE_BIT
+	bool
+	default y if HAVE_MLOCK=y && UNEVICTABLE_LRU=y
+
 config MMU_NOTIFIER
 	bool
diff --git a/mm/internal.h b/mm/internal.h
index 478223b..987bb03 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -63,6 +63,7 @@ static inline unsigned long page_order(struct page *page)
 	return page_private(page);
 }
 
+#ifdef CONFIG_HAVE_MLOCK
 extern long mlock_vma_pages_range(struct vm_area_struct *vma,
 			unsigned long start, unsigned long end);
 extern void munlock_vma_pages_range(struct vm_area_struct *vma,
@@ -71,6 +72,7 @@ static inline void munlock_vma_pages_all(struct vm_area_struct *vma)
 {
 	munlock_vma_pages_range(vma, vma->vm_start, vma->vm_end);
 }
+#endif
 
 #ifdef CONFIG_UNEVICTABLE_LRU
 /*
@@ -90,7 +92,7 @@ static inline void unevictable_migrate_page(struct page *new, struct page *old)
 }
 #endif
 
-#ifdef CONFIG_UNEVICTABLE_LRU
+#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
 /*
  * Called only in fault path via page_evictable() for a new page
  * to determine if it's being mapped into a LOCKED vma.
@@ -165,7 +167,7 @@ static inline void free_page_mlock(struct page *page)
 	}
 }
 
-#else /* CONFIG_UNEVICTABLE_LRU */
+#else /* CONFIG_HAVE_MLOCKED_PAGE_BIT */
 static inline int is_mlocked_vma(struct vm_area_struct *v, struct page *p)
 {
 	return 0;
@@ -175,7 +177,7 @@ static inline void mlock_vma_page(struct page *page) { }
 static inline void mlock_migrate_page(struct page *new, struct page *old) { }
 static inline void free_page_mlock(struct page *page) { }
 
-#endif /* CONFIG_UNEVICTABLE_LRU */
+#endif /* CONFIG_HAVE_MLOCKED_PAGE_BIT */
 
 /*
  * Return the mem_map entry representing the 'offset' subpage within

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-03-13 17:34 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090311153034.9389.19938.stgit@warthog.procyon.org.uk>
2009-03-11 22:03 ` [PATCH] NOMMU: Pages allocated to a ramfs inode's pagecache may get wrongly discarded Andrew Morton
2009-03-11 22:36   ` Johannes Weiner
2009-03-12  0:02   ` Andrew Morton
2009-03-12  0:35     ` Minchan Kim
2009-03-12  1:04       ` KOSAKI Motohiro
2009-03-12  1:52         ` Minchan Kim
2009-03-12  1:56           ` Minchan Kim
2009-03-12  2:00           ` KOSAKI Motohiro
2009-03-12  2:11             ` Minchan Kim
2009-03-12 12:19         ` Robin Getz
2009-03-12 17:55           ` [uClinux-dev] " Jamie Lokier
2009-03-13 17:33         ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU David Howells
2009-03-13 17:33           ` David Howells [this message]
2009-03-14 11:17             ` [PATCH 1/2] NOMMU: There is no mlock() for NOMMU, so don't provide the bits KOSAKI Motohiro
2009-03-13 17:33           ` [PATCH 2/2] NOMMU: Make CONFIG_UNEVICTABLE_LRU available when CONFIG_MMU=n David Howells
2009-03-14 11:17             ` KOSAKI Motohiro
2009-03-14  0:27           ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU Minchan Kim
2009-03-20 16:08             ` Lee Schermerhorn
2009-03-20 16:24             ` David Howells
2009-03-20 18:30               ` Lee Schermerhorn
2009-03-21 10:20                 ` Johannes Weiner
2009-03-22 20:13                   ` [patch 1/3] mm: decouple unevictable lru from mmu Johannes Weiner
2009-03-22 23:46                     ` KOSAKI Motohiro
2009-03-23  0:14                       ` Johannes Weiner
2009-03-23 10:48                       ` David Howells
2009-03-22 20:13                   ` [patch 2/3] ramfs-nommu: use generic lru cache Johannes Weiner
2009-03-23  2:22                     ` KOSAKI Motohiro
2009-03-22 20:13                   ` [patch 3/3] mm: keep pages from unevictable mappings off the LRU lists Johannes Weiner
2009-03-23  0:44                     ` Minchan Kim
2009-03-23  2:21                       ` KOSAKI Motohiro
2009-03-23  8:42                         ` Johannes Weiner
2009-03-23  9:01                           ` KOSAKI Motohiro
2009-03-23  9:23                             ` KOSAKI Motohiro
2009-03-26  0:48                               ` Johannes Weiner
2009-03-23 10:40                   ` [patch 2/3] ramfs-nommu: use generic lru cache David Howells
2009-03-23 10:53                   ` [patch 3/3] mm: keep pages from unevictable mappings off the LRU lists David Howells
2009-03-26  0:01                     ` Johannes Weiner
2009-03-26  8:56                       ` KOSAKI Motohiro
2009-03-26 10:36                         ` Johannes Weiner
2009-03-23 20:07                   ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU Lee Schermerhorn
2009-03-13 11:53       ` [PATCH] NOMMU: Pages allocated to a ramfs inode's pagecache may get wrongly discarded David Howells
2009-03-13 22:49         ` Johannes Weiner

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=20090313173348.10169.31420.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=nrik.Berkhan@ge.com \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=uclinux-dev@uclinux.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;
as well as URLs for NNTP newsgroup(s).