linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: shaggy@austin.ibm.com, jens.axboe@oracle.com,
	torvalds@linux-foundation.org, linux-mm@kvack.org,
	linux-arch@vger.kernel.org, apw@shadowen.org
Subject: [patch 1/2] x86: implement pte_special
Date: Sun, 25 May 2008 16:48:47 +0200	[thread overview]
Message-ID: <20080525144847.GB25747@wotan.suse.de> (raw)

Implement the pte_special bit for x86. This is required to support lockless
get_user_pages, because we need to know whether or not we can refcount a
particular page given only its pte (and no vma).

Signed-off-by: Nick Piggin <npiggin@suse.de>
---
Index: linux-2.6/include/asm-x86/pgtable.h
===================================================================
--- linux-2.6.orig/include/asm-x86/pgtable.h
+++ linux-2.6/include/asm-x86/pgtable.h
@@ -17,6 +17,7 @@
 #define _PAGE_BIT_UNUSED1	9	/* available for programmer */
 #define _PAGE_BIT_UNUSED2	10
 #define _PAGE_BIT_UNUSED3	11
+#define _PAGE_BIT_SPECIAL	_PAGE_BIT_UNUSED1
 #define _PAGE_BIT_PAT_LARGE	12	/* On 2MB or 1GB pages */
 #define _PAGE_BIT_NX           63       /* No execute: only valid after cpuid check */
 
@@ -39,6 +40,8 @@
 #define _PAGE_UNUSED3	(_AC(1, L)<<_PAGE_BIT_UNUSED3)
 #define _PAGE_PAT	(_AC(1, L)<<_PAGE_BIT_PAT)
 #define _PAGE_PAT_LARGE (_AC(1, L)<<_PAGE_BIT_PAT_LARGE)
+#define _PAGE_SPECIAL	(_AC(1, L)<<_PAGE_BIT_SPECIAL)
+#define __HAVE_ARCH_PTE_SPECIAL
 
 #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
 #define _PAGE_NX	(_AC(1, ULL) << _PAGE_BIT_NX)
@@ -199,7 +202,7 @@ static inline int pte_exec(pte_t pte)
 
 static inline int pte_special(pte_t pte)
 {
-	return 0;
+	return pte_val(pte) & _PAGE_SPECIAL;
 }
 
 static inline int pmd_large(pmd_t pte)
@@ -265,7 +268,7 @@ static inline pte_t pte_clrglobal(pte_t 
 
 static inline pte_t pte_mkspecial(pte_t pte)
 {
-	return pte;
+	return __pte(pte_val(pte) | _PAGE_SPECIAL);
 }
 
 extern pteval_t __supported_pte_mask;

--
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:[~2008-05-25 14:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-25 14:48 Nick Piggin [this message]
2008-05-25 14:52 ` [patch 2/2] lockless get_user_pages Nick Piggin
2008-05-25 17:18   ` Johannes Weiner
2008-05-26  1:40     ` Nick Piggin
2008-05-26 15:02   ` Johannes Weiner
2008-05-27  0:57     ` KOSAKI Motohiro
2008-05-27  2:28       ` Nick Piggin
2008-05-27  2:46         ` KOSAKI Motohiro
2008-05-27  2:57           ` Nick Piggin
2008-05-29  3:43           ` Nick Piggin
2008-05-28 11:39   ` Andy Whitcroft
2008-05-28 12:28     ` Nick Piggin
2008-05-28 14:32       ` Nick Piggin
  -- strict thread matches above, loose matches on Subject: below --
2008-05-21 11:59 [patch 1/2] x86: implement pte_special Nick Piggin
2008-03-28  2:54 [patch 0/2]: lockless get_user_pages patchset Nick Piggin
2008-03-28  2:55 ` [patch 1/2]: x86: implement pte_special Nick Piggin
2008-03-28  3:23   ` David Miller, Nick Piggin
2008-03-28  3:31     ` Nick Piggin
2008-03-28  3:44       ` David Miller, Nick Piggin
2008-03-28  4:04         ` Nick Piggin
2008-03-28  4:09           ` David Miller, Nick Piggin
2008-03-28  4:15             ` Nick Piggin
2008-03-28  4:16               ` David Miller, Nick Piggin
2008-03-28  4:19                 ` Nick Piggin
2008-03-28  4:17               ` Nick Piggin

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=20080525144847.GB25747@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=jens.axboe@oracle.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shaggy@austin.ibm.com \
    --cc=torvalds@linux-foundation.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).