linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Christoph Lameter <cl@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Matt Mackall <mpm@selenic.com>, Nick Piggin <npiggin@suse.de>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 17/24] mm: export stable page flags
Date: Wed, 2 Dec 2009 12:42:45 +0800	[thread overview]
Message-ID: <20091202044244.GA29928@localhost> (raw)
In-Reply-To: <20091202043045.852342473@intel.com>

[corrected CC to Christoph Lameter <cl@linux-foundation.org>]

On Wed, Dec 02, 2009 at 11:12:48AM +0800, Wu, Fengguang wrote:
> Rename get_uflags() to stable_page_flags() and make it a global function
> for use in the hwpoison page flags filter, which need to compare user
> page flags with the value provided by user space.
> 
> Also move KPF_* to kernel-page-flags.h for use by user space tools.
> 
> CC: Matt Mackall <mpm@selenic.com>
> CC: Nick Piggin <npiggin@suse.de>
> CC: Christoph Lameter <clameter@sgi.com>
> CC: Andi Kleen <andi@firstfloor.org>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
> ---
>  fs/proc/page.c                    |   45 +--------------------------
>  include/linux/kernel-page-flags.h |   46 ++++++++++++++++++++++++++++
>  include/linux/page-flags.h        |    2 +
>  3 files changed, 51 insertions(+), 42 deletions(-)
> 
> --- linux-mm.orig/fs/proc/page.c	2009-11-07 20:23:59.000000000 +0800
> +++ linux-mm/fs/proc/page.c	2009-11-07 20:37:31.000000000 +0800
> @@ -8,6 +8,7 @@
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/hugetlb.h>
> +#include <linux/kernel-page-flags.h>
>  #include <asm/uaccess.h>
>  #include "internal.h"
>  
> @@ -71,52 +72,12 @@ static const struct file_operations proc
>   * physical page flags.
>   */
>  
> -/* These macros are used to decouple internal flags from exported ones */
> -
> -#define KPF_LOCKED		0
> -#define KPF_ERROR		1
> -#define KPF_REFERENCED		2
> -#define KPF_UPTODATE		3
> -#define KPF_DIRTY		4
> -#define KPF_LRU			5
> -#define KPF_ACTIVE		6
> -#define KPF_SLAB		7
> -#define KPF_WRITEBACK		8
> -#define KPF_RECLAIM		9
> -#define KPF_BUDDY		10
> -
> -/* 11-20: new additions in 2.6.31 */
> -#define KPF_MMAP		11
> -#define KPF_ANON		12
> -#define KPF_SWAPCACHE		13
> -#define KPF_SWAPBACKED		14
> -#define KPF_COMPOUND_HEAD	15
> -#define KPF_COMPOUND_TAIL	16
> -#define KPF_HUGE		17
> -#define KPF_UNEVICTABLE		18
> -#define KPF_HWPOISON		19
> -#define KPF_NOPAGE		20
> -
> -#define KPF_KSM			21
> -
> -/* kernel hacking assistances
> - * WARNING: subject to change, never rely on them!
> - */
> -#define KPF_RESERVED		32
> -#define KPF_MLOCKED		33
> -#define KPF_MAPPEDTODISK	34
> -#define KPF_PRIVATE		35
> -#define KPF_PRIVATE_2		36
> -#define KPF_OWNER_PRIVATE	37
> -#define KPF_ARCH		38
> -#define KPF_UNCACHED		39
> -
>  static inline u64 kpf_copy_bit(u64 kflags, int ubit, int kbit)
>  {
>  	return ((kflags >> kbit) & 1) << ubit;
>  }
>  
> -static u64 get_uflags(struct page *page)
> +u64 stable_page_flags(struct page *page)
>  {
>  	u64 k;
>  	u64 u;
> @@ -219,7 +180,7 @@ static ssize_t kpageflags_read(struct fi
>  		else
>  			ppage = NULL;
>  
> -		if (put_user(get_uflags(ppage), out)) {
> +		if (put_user(stable_page_flags(ppage), out)) {
>  			ret = -EFAULT;
>  			break;
>  		}
> --- linux-mm.orig/include/linux/page-flags.h	2009-11-07 20:37:27.000000000 +0800
> +++ linux-mm/include/linux/page-flags.h	2009-11-07 20:37:31.000000000 +0800
> @@ -284,6 +284,8 @@ PAGEFLAG_FALSE(HWPoison)
>  #define __PG_HWPOISON 0
>  #endif
>  
> +u64 stable_page_flags(struct page *page);
> +
>  static inline int PageUptodate(struct page *page)
>  {
>  	int ret = test_bit(PG_uptodate, &(page)->flags);
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ linux-mm/include/linux/kernel-page-flags.h	2009-11-07 20:37:31.000000000 +0800
> @@ -0,0 +1,46 @@
> +#ifndef LINUX_KERNEL_PAGE_FLAGS_H
> +#define  LINUX_KERNEL_PAGE_FLAGS_H
> +
> +/*
> + * Stable page flag bits exported to user space
> + */
> +
> +#define KPF_LOCKED		0
> +#define KPF_ERROR		1
> +#define KPF_REFERENCED		2
> +#define KPF_UPTODATE		3
> +#define KPF_DIRTY		4
> +#define KPF_LRU			5
> +#define KPF_ACTIVE		6
> +#define KPF_SLAB		7
> +#define KPF_WRITEBACK		8
> +#define KPF_RECLAIM		9
> +#define KPF_BUDDY		10
> +
> +/* 11-20: new additions in 2.6.31 */
> +#define KPF_MMAP		11
> +#define KPF_ANON		12
> +#define KPF_SWAPCACHE		13
> +#define KPF_SWAPBACKED		14
> +#define KPF_COMPOUND_HEAD	15
> +#define KPF_COMPOUND_TAIL	16
> +#define KPF_HUGE		17
> +#define KPF_UNEVICTABLE		18
> +#define KPF_HWPOISON		19
> +#define KPF_NOPAGE		20
> +
> +#define KPF_KSM			21
> +
> +/* kernel hacking assistances
> + * WARNING: subject to change, never rely on them!
> + */
> +#define KPF_RESERVED		32
> +#define KPF_MLOCKED		33
> +#define KPF_MAPPEDTODISK	34
> +#define KPF_PRIVATE		35
> +#define KPF_PRIVATE_2		36
> +#define KPF_OWNER_PRIVATE	37
> +#define KPF_ARCH		38
> +#define KPF_UNCACHED		39
> +
> +#endif /* LINUX_KERNEL_PAGE_FLAGS_H */
> 

--
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-12-02  4:42 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02  3:12 [PATCH 00/24] hwpoison fixes and stress testing filters Wu Fengguang
2009-12-02  3:12 ` [PATCH 01/24] page-types: add standard GPL license head Wu Fengguang
2009-12-02 13:08   ` Andi Kleen
2009-12-02  3:12 ` [PATCH 02/24] migrate: page could be locked by hwpoison, dont BUG() Wu Fengguang
2009-12-02 13:09   ` Andi Kleen
2009-12-02 14:50   ` Christoph Lameter
2009-12-03  1:34     ` Wu Fengguang
2009-12-02  3:12 ` [PATCH 03/24] HWPOISON: remove the anonymous entry Wu Fengguang
2009-12-02  3:12 ` [PATCH 04/24] HWPOISON: return ENXIO on invalid pfn Wu Fengguang
2009-12-02  3:12 ` [PATCH 05/24] HWPOISON: avoid grabbing page for two times Wu Fengguang
2009-12-02  3:12 ` [PATCH 06/24] HWPOISON: abort on failed unmap Wu Fengguang
2009-12-02 13:11   ` Andi Kleen
2009-12-02 13:28     ` Wu Fengguang
2009-12-02 13:44       ` Andi Kleen
2009-12-02  3:12 ` [PATCH 07/24] HWPOISON: comment the possible set_page_dirty() race Wu Fengguang
2009-12-02  3:12 ` [PATCH 08/24] HWPOISON: comment dirty swapcache pages Wu Fengguang
2009-12-02  3:12 ` [PATCH 09/24] HWPOISON: introduce delete_from_lru_cache() Wu Fengguang
2009-12-02  3:12 ` [PATCH 10/24] HWPOISON: remove the free buddy page handler Wu Fengguang
2009-12-02 13:13   ` Andi Kleen
2009-12-02 13:31     ` Wu Fengguang
2009-12-02  3:12 ` [PATCH 11/24] HWPOISON: detect free buddy pages explicitly Wu Fengguang
2009-12-02  3:12 ` [PATCH 12/24] HWPOISON: make it possible to unpoison pages Wu Fengguang
2009-12-02 13:15   ` Andi Kleen
2009-12-02 13:31     ` Wu Fengguang
2009-12-02 13:46     ` Wu Fengguang
2009-12-02 14:03       ` Andi Kleen
2009-12-03  1:45         ` Wu Fengguang
2009-12-02  3:12 ` [PATCH 13/24] HWPOISON: introduce struct hwpoison_control Wu Fengguang
2009-12-02 13:15   ` Andi Kleen
2009-12-02  3:12 ` [PATCH 14/24] HWPOISON: return 0 if page is assured to be isolated Wu Fengguang
2009-12-02 12:47   ` Andi Kleen
2009-12-02 13:15     ` Wu Fengguang
2009-12-02  3:12 ` [PATCH 15/24] HWPOISON: add fs/device filters Wu Fengguang
2009-12-02  3:12 ` [PATCH 16/24] HWPOISON: limit hwpoison injector to known page types Wu Fengguang
2009-12-02  8:11   ` Ingo Molnar
2009-12-02  3:12 ` [PATCH 17/24] mm: export stable page flags Wu Fengguang
2009-12-02  4:42   ` Wu Fengguang [this message]
2009-12-02  3:12 ` [PATCH 18/24] HWPOISON: add page flags filter Wu Fengguang
2009-12-02  3:12 ` [PATCH 19/24] memcg: rename and export try_get_mem_cgroup_from_page() Wu Fengguang
2009-12-03  1:58   ` Balbir Singh
2009-12-02  3:12 ` [PATCH 20/24] memcg: add accessor to mem_cgroup.css Wu Fengguang
2009-12-02  3:12 ` [PATCH 21/24] cgroup: define empty css_put() when !CONFIG_CGROUPS Wu Fengguang
2009-12-02 22:48   ` Paul Menage
2009-12-02 22:52     ` Andi Kleen
2009-12-03  1:53       ` Wu Fengguang
2009-12-02  3:12 ` [PATCH 22/24] HWPOISON: add memory cgroup filter Wu Fengguang
2009-12-02 12:44   ` Andi Kleen
2009-12-02 12:58     ` Wu Fengguang
2009-12-03  1:52       ` KAMEZAWA Hiroyuki
2009-12-03  2:19         ` Wu Fengguang
2009-12-03  2:28           ` KAMEZAWA Hiroyuki
2009-12-03  2:47             ` Wu Fengguang
2009-12-03  2:58               ` KAMEZAWA Hiroyuki
2009-12-03 15:03                 ` Wu Fengguang
2009-12-03  2:15       ` Li Zefan
2009-12-03  2:20         ` Wu Fengguang
2009-12-03  2:28         ` Wu Fengguang
2009-12-02  3:12 ` [PATCH 23/24] HWPOISON: add an interface to switch off/on all the page filters Wu Fengguang
2009-12-02  3:12 ` [PATCH 24/24] HWPOISON: show corrupted file info Wu Fengguang
2009-12-02 13:20   ` Andi Kleen
2009-12-02 13:37     ` Wu Fengguang

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=20091202044244.GA29928@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=npiggin@suse.de \
    /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