linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Restrict size of page_cgroup->flags
@ 2010-10-06 14:23 Balbir Singh
  2010-10-06 23:58 ` KAMEZAWA Hiroyuki
  2010-10-07  0:54 ` Daisuke Nishimura
  0 siblings, 2 replies; 13+ messages in thread
From: Balbir Singh @ 2010-10-06 14:23 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki, containers
  Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org

I propose restricting page_cgroup.flags to 16 bits. The patch for the
same is below. Comments?


Restrict the bits usage in page_cgroup.flags

From: Balbir Singh <balbir@linux.vnet.ibm.com>

Restricting the flags helps control growth of the flags unbound.
Restriciting it to 16 bits gives us the possibility of merging
cgroup id with flags (atomicity permitting) and saving a whole
long word in page_cgroup

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
---

 include/linux/page_cgroup.h |    3 +++
 mm/page_cgroup.c            |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 872f6b1..10c37b4 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -44,8 +44,11 @@ enum {
 	PCG_FILE_WRITEBACK, /* page is under writeback */
 	PCG_FILE_UNSTABLE_NFS, /* page is NFS unstable */
 	PCG_MIGRATION, /* under page migration */
+	PCG_MAX_NR,
 };
 
+#define PCG_MAX_BIT_SIZE	16
+
 #define TESTPCGFLAG(uname, lname)			\
 static inline int PageCgroup##uname(struct page_cgroup *pc)	\
 	{ return test_bit(PCG_##lname, &pc->flags); }
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 5bffada..e16ad2e 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -258,6 +258,7 @@ void __init page_cgroup_init(void)
 	unsigned long pfn;
 	int fail = 0;
 
+	BUILD_BUG_ON(PCG_MAX_NR >= PCG_MAX_BIT_SIZE);
 	if (mem_cgroup_disabled())
 		return;
 

-- 
	Three Cheers,
	Balbir

--
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>

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-06 14:23 [RFC] Restrict size of page_cgroup->flags Balbir Singh
@ 2010-10-06 23:58 ` KAMEZAWA Hiroyuki
  2010-10-07  3:12   ` Balbir Singh
  2010-10-07  0:54 ` Daisuke Nishimura
  1 sibling, 1 reply; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-10-06 23:58 UTC (permalink / raw)
  To: balbir; +Cc: containers, linux-mm@kvack.org, linux-kernel@vger.kernel.org

On Wed, 6 Oct 2010 19:53:14 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> I propose restricting page_cgroup.flags to 16 bits. The patch for the
> same is below. Comments?
> 
> 
> Restrict the bits usage in page_cgroup.flags
> 
> From: Balbir Singh <balbir@linux.vnet.ibm.com>
> 
> Restricting the flags helps control growth of the flags unbound.
> Restriciting it to 16 bits gives us the possibility of merging
> cgroup id with flags (atomicity permitting) and saving a whole
> long word in page_cgroup
> 
> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>

Doesn't make sense until you show the usage of existing bits.
And I guess 16bit may be too large on 32bit systems.

Nack for now.

Thanks,
-Kame

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-06 14:23 [RFC] Restrict size of page_cgroup->flags Balbir Singh
  2010-10-06 23:58 ` KAMEZAWA Hiroyuki
@ 2010-10-07  0:54 ` Daisuke Nishimura
  2010-10-07  3:14   ` Balbir Singh
  1 sibling, 1 reply; 13+ messages in thread
From: Daisuke Nishimura @ 2010-10-07  0:54 UTC (permalink / raw)
  To: balbir
  Cc: KAMEZAWA Hiroyuki, containers, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Daisuke Nishimura

On Wed, 6 Oct 2010 19:53:14 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> I propose restricting page_cgroup.flags to 16 bits. The patch for the
> same is below. Comments?
> 
> 
> Restrict the bits usage in page_cgroup.flags
> 
> From: Balbir Singh <balbir@linux.vnet.ibm.com>
> 
> Restricting the flags helps control growth of the flags unbound.
> Restriciting it to 16 bits gives us the possibility of merging
> cgroup id with flags (atomicity permitting) and saving a whole
> long word in page_cgroup
> 
I agree that reducing the size of page_cgroup would be good and important.
But, wouldn't it be better to remove ->page, if possible ?

Thanks,
Daisuke Nishimura.

> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> ---
> 
>  include/linux/page_cgroup.h |    3 +++
>  mm/page_cgroup.c            |    1 +
>  2 files changed, 4 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
> index 872f6b1..10c37b4 100644
> --- a/include/linux/page_cgroup.h
> +++ b/include/linux/page_cgroup.h
> @@ -44,8 +44,11 @@ enum {
>  	PCG_FILE_WRITEBACK, /* page is under writeback */
>  	PCG_FILE_UNSTABLE_NFS, /* page is NFS unstable */
>  	PCG_MIGRATION, /* under page migration */
> +	PCG_MAX_NR,
>  };
>  
> +#define PCG_MAX_BIT_SIZE	16
> +
>  #define TESTPCGFLAG(uname, lname)			\
>  static inline int PageCgroup##uname(struct page_cgroup *pc)	\
>  	{ return test_bit(PCG_##lname, &pc->flags); }
> diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
> index 5bffada..e16ad2e 100644
> --- a/mm/page_cgroup.c
> +++ b/mm/page_cgroup.c
> @@ -258,6 +258,7 @@ void __init page_cgroup_init(void)
>  	unsigned long pfn;
>  	int fail = 0;
>  
> +	BUILD_BUG_ON(PCG_MAX_NR >= PCG_MAX_BIT_SIZE);
>  	if (mem_cgroup_disabled())
>  		return;
>  
> 
> -- 
> 	Three Cheers,
> 	Balbir
> 
> --
> 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>
> 

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-06 23:58 ` KAMEZAWA Hiroyuki
@ 2010-10-07  3:12   ` Balbir Singh
  2010-10-07  3:18     ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 13+ messages in thread
From: Balbir Singh @ 2010-10-07  3:12 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: containers, linux-mm@kvack.org, linux-kernel@vger.kernel.org

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 08:58:58]:

> On Wed, 6 Oct 2010 19:53:14 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
> > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > same is below. Comments?
> > 
> > 
> > Restrict the bits usage in page_cgroup.flags
> > 
> > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > 
> > Restricting the flags helps control growth of the flags unbound.
> > Restriciting it to 16 bits gives us the possibility of merging
> > cgroup id with flags (atomicity permitting) and saving a whole
> > long word in page_cgroup
> > 
> > Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> 
> Doesn't make sense until you show the usage of existing bits.

??

> And I guess 16bit may be too large on 32bit systems.

too large on 32 bit systems? My intention is to keep the flags to 16
bits and then use cgroup id for the rest and see if we can remove
mem_cgroup pointer

> Nack for now.
>

The issue is - do you see further growth of flags?
 
> Thanks,
> -Kame
> 

-- 
	Three Cheers,
	Balbir

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  0:54 ` Daisuke Nishimura
@ 2010-10-07  3:14   ` Balbir Singh
  2010-10-07  3:47     ` Daisuke Nishimura
  0 siblings, 1 reply; 13+ messages in thread
From: Balbir Singh @ 2010-10-07  3:14 UTC (permalink / raw)
  To: Daisuke Nishimura
  Cc: KAMEZAWA Hiroyuki, containers, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org

* nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2010-10-07 09:54:58]:

> On Wed, 6 Oct 2010 19:53:14 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
> > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > same is below. Comments?
> > 
> > 
> > Restrict the bits usage in page_cgroup.flags
> > 
> > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > 
> > Restricting the flags helps control growth of the flags unbound.
> > Restriciting it to 16 bits gives us the possibility of merging
> > cgroup id with flags (atomicity permitting) and saving a whole
> > long word in page_cgroup
> > 
> I agree that reducing the size of page_cgroup would be good and important.
> But, wouldn't it be better to remove ->page, if possible ?
>

Without the page pointer, how do we go from pc to page for reclaim? 

-- 
	Three Cheers,
	Balbir

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  3:12   ` Balbir Singh
@ 2010-10-07  3:18     ` KAMEZAWA Hiroyuki
  2010-10-07  3:56       ` Balbir Singh
  0 siblings, 1 reply; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-10-07  3:18 UTC (permalink / raw)
  To: balbir; +Cc: containers, linux-mm@kvack.org, linux-kernel@vger.kernel.org

On Thu, 7 Oct 2010 08:42:04 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 08:58:58]:
> 
> > On Wed, 6 Oct 2010 19:53:14 +0530
> > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > 
> > > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > > same is below. Comments?
> > > 
> > > 
> > > Restrict the bits usage in page_cgroup.flags
> > > 
> > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > 
> > > Restricting the flags helps control growth of the flags unbound.
> > > Restriciting it to 16 bits gives us the possibility of merging
> > > cgroup id with flags (atomicity permitting) and saving a whole
> > > long word in page_cgroup
> > > 
> > > Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> > 
> > Doesn't make sense until you show the usage of existing bits.
> 
> ??
> 
Limiting something for NOT EXISTING PATCH doesn't make sense, in general.


> > And I guess 16bit may be too large on 32bit systems.
> 
> too large on 32 bit systems? My intention is to keep the flags to 16
> bits and then use cgroup id for the rest and see if we can remove
> mem_cgroup pointer
> 

You can't use flags field to store mem_cgroup_id while we use lock bit on it.
We have to store something more stable...as pfn or node-id or zone-id.

It's very racy. 

Thanks,
-Kame

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  3:14   ` Balbir Singh
@ 2010-10-07  3:47     ` Daisuke Nishimura
  2010-10-07  4:08       ` Balbir Singh
  0 siblings, 1 reply; 13+ messages in thread
From: Daisuke Nishimura @ 2010-10-07  3:47 UTC (permalink / raw)
  To: balbir
  Cc: KAMEZAWA Hiroyuki, containers, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Daisuke Nishimura

On Thu, 7 Oct 2010 08:44:59 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> * nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2010-10-07 09:54:58]:
> 
> > On Wed, 6 Oct 2010 19:53:14 +0530
> > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > 
> > > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > > same is below. Comments?
> > > 
> > > 
> > > Restrict the bits usage in page_cgroup.flags
> > > 
> > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > 
> > > Restricting the flags helps control growth of the flags unbound.
> > > Restriciting it to 16 bits gives us the possibility of merging
> > > cgroup id with flags (atomicity permitting) and saving a whole
> > > long word in page_cgroup
> > > 
> > I agree that reducing the size of page_cgroup would be good and important.
> > But, wouldn't it be better to remove ->page, if possible ?
> >
> 
> Without the page pointer, how do we go from pc to page for reclaim? 
> 
We store page_cgroups in arrays now, so I suppose we can implement pc_to_pfn()
using the similar calculation as page_to_pfn() does.
IIRC, KAMEZAWA-san talked about it in another thread.

Thanks,
Daisuke Nishimura.

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  3:18     ` KAMEZAWA Hiroyuki
@ 2010-10-07  3:56       ` Balbir Singh
  2010-10-07  4:22         ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 13+ messages in thread
From: Balbir Singh @ 2010-10-07  3:56 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-mm@kvack.org, containers, linux-kernel@vger.kernel.org

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 12:18:16]:

> On Thu, 7 Oct 2010 08:42:04 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
> > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 08:58:58]:
> > 
> > > On Wed, 6 Oct 2010 19:53:14 +0530
> > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > 
> > > > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > > > same is below. Comments?
> > > > 
> > > > 
> > > > Restrict the bits usage in page_cgroup.flags
> > > > 
> > > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > 
> > > > Restricting the flags helps control growth of the flags unbound.
> > > > Restriciting it to 16 bits gives us the possibility of merging
> > > > cgroup id with flags (atomicity permitting) and saving a whole
> > > > long word in page_cgroup
> > > > 
> > > > Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > 
> > > Doesn't make sense until you show the usage of existing bits.
> > 
> > ??
> > 
> Limiting something for NOT EXISTING PATCH doesn't make sense, in general.
> 
> 
> > > And I guess 16bit may be too large on 32bit systems.
> > 
> > too large on 32 bit systems? My intention is to keep the flags to 16
> > bits and then use cgroup id for the rest and see if we can remove
> > mem_cgroup pointer
> > 
> 
> You can't use flags field to store mem_cgroup_id while we use lock bit on it.
> We have to store something more stable...as pfn or node-id or zone-id.
> 
> It's very racy. 
>

Yes, correct it is racy, there is no easy way from what I know we can write
the upper 16 bits of the flag without affecting the lower 16 bits, if
the 16 bits are changing. One of the techniques could be to have lock
for the unsigned long word itself - but I don't know what performance
overhead that would add. Having said that I would like to explore
techniques that allow me to merge the two.

-- 
	Three Cheers,
	Balbir

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  3:47     ` Daisuke Nishimura
@ 2010-10-07  4:08       ` Balbir Singh
  0 siblings, 0 replies; 13+ messages in thread
From: Balbir Singh @ 2010-10-07  4:08 UTC (permalink / raw)
  To: Daisuke Nishimura
  Cc: KAMEZAWA Hiroyuki, containers, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org

* nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2010-10-07 12:47:06]:

> On Thu, 7 Oct 2010 08:44:59 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
> > * nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2010-10-07 09:54:58]:
> > 
> > > On Wed, 6 Oct 2010 19:53:14 +0530
> > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > 
> > > > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > > > same is below. Comments?
> > > > 
> > > > 
> > > > Restrict the bits usage in page_cgroup.flags
> > > > 
> > > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > 
> > > > Restricting the flags helps control growth of the flags unbound.
> > > > Restriciting it to 16 bits gives us the possibility of merging
> > > > cgroup id with flags (atomicity permitting) and saving a whole
> > > > long word in page_cgroup
> > > > 
> > > I agree that reducing the size of page_cgroup would be good and important.
> > > But, wouldn't it be better to remove ->page, if possible ?
> > >
> > 
> > Without the page pointer, how do we go from pc to page for reclaim? 
> > 
> We store page_cgroups in arrays now, so I suppose we can implement pc_to_pfn()
> using the similar calculation as page_to_pfn() does.
> IIRC, KAMEZAWA-san talked about it in another thread.
>

Yes, correct we do. Your suggestions, IIUC is to reuse part of the
flags to store the section number where the pc belongs and then use
that to remove ->page pointer.

-- 
	Three Cheers,
	Balbir

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  3:56       ` Balbir Singh
@ 2010-10-07  4:22         ` KAMEZAWA Hiroyuki
  2010-10-07  5:31           ` Balbir Singh
  2010-10-07  5:44           ` Daisuke Nishimura
  0 siblings, 2 replies; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-10-07  4:22 UTC (permalink / raw)
  To: balbir; +Cc: linux-mm@kvack.org, containers, linux-kernel@vger.kernel.org

On Thu, 7 Oct 2010 09:26:08 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 12:18:16]:
> 
> > On Thu, 7 Oct 2010 08:42:04 +0530
> > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > 
> > > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 08:58:58]:
> > > 
> > > > On Wed, 6 Oct 2010 19:53:14 +0530
> > > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > > 
> > > > > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > > > > same is below. Comments?
> > > > > 
> > > > > 
> > > > > Restrict the bits usage in page_cgroup.flags
> > > > > 
> > > > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > > 
> > > > > Restricting the flags helps control growth of the flags unbound.
> > > > > Restriciting it to 16 bits gives us the possibility of merging
> > > > > cgroup id with flags (atomicity permitting) and saving a whole
> > > > > long word in page_cgroup
> > > > > 
> > > > > Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > 
> > > > Doesn't make sense until you show the usage of existing bits.
> > > 
> > > ??
> > > 
> > Limiting something for NOT EXISTING PATCH doesn't make sense, in general.
> > 
> > 
> > > > And I guess 16bit may be too large on 32bit systems.
> > > 
> > > too large on 32 bit systems? My intention is to keep the flags to 16
> > > bits and then use cgroup id for the rest and see if we can remove
> > > mem_cgroup pointer
> > > 
> > 
> > You can't use flags field to store mem_cgroup_id while we use lock bit on it.
> > We have to store something more stable...as pfn or node-id or zone-id.
> > 
> > It's very racy. 
> >
> 
> Yes, correct it is racy, there is no easy way from what I know we can write
> the upper 16 bits of the flag without affecting the lower 16 bits, if
> the 16 bits are changing. One of the techniques could be to have lock
> for the unsigned long word itself - but I don't know what performance
> overhead that would add. Having said that I would like to explore
> techniques that allow me to merge the two.
> 

to store pfn, we need to limit under 12bit.
I'll schedule my patch if dirty_ratio one goes.

Thanks,
-Kame


--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  4:22         ` KAMEZAWA Hiroyuki
@ 2010-10-07  5:31           ` Balbir Singh
  2010-10-07  5:39             ` KAMEZAWA Hiroyuki
  2010-10-07  5:44           ` Daisuke Nishimura
  1 sibling, 1 reply; 13+ messages in thread
From: Balbir Singh @ 2010-10-07  5:31 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-mm@kvack.org, containers, linux-kernel@vger.kernel.org

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 13:22:33]:

> On Thu, 7 Oct 2010 09:26:08 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
> > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 12:18:16]:
> > 
> > > On Thu, 7 Oct 2010 08:42:04 +0530
> > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > 
> > > > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 08:58:58]:
> > > > 
> > > > > On Wed, 6 Oct 2010 19:53:14 +0530
> > > > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > > > 
> > > > > > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > > > > > same is below. Comments?
> > > > > > 
> > > > > > 
> > > > > > Restrict the bits usage in page_cgroup.flags
> > > > > > 
> > > > > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > > > 
> > > > > > Restricting the flags helps control growth of the flags unbound.
> > > > > > Restriciting it to 16 bits gives us the possibility of merging
> > > > > > cgroup id with flags (atomicity permitting) and saving a whole
> > > > > > long word in page_cgroup
> > > > > > 
> > > > > > Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > > 
> > > > > Doesn't make sense until you show the usage of existing bits.
> > > > 
> > > > ??
> > > > 
> > > Limiting something for NOT EXISTING PATCH doesn't make sense, in general.
> > > 
> > > 
> > > > > And I guess 16bit may be too large on 32bit systems.
> > > > 
> > > > too large on 32 bit systems? My intention is to keep the flags to 16
> > > > bits and then use cgroup id for the rest and see if we can remove
> > > > mem_cgroup pointer
> > > > 
> > > 
> > > You can't use flags field to store mem_cgroup_id while we use lock bit on it.
> > > We have to store something more stable...as pfn or node-id or zone-id.
> > > 
> > > It's very racy. 
> > >
> > 
> > Yes, correct it is racy, there is no easy way from what I know we can write
> > the upper 16 bits of the flag without affecting the lower 16 bits, if
> > the 16 bits are changing. One of the techniques could be to have lock
> > for the unsigned long word itself - but I don't know what performance
> > overhead that would add. Having said that I would like to explore
> > techniques that allow me to merge the two.
> > 
> 
> to store pfn, we need to limit under 12bit.
> I'll schedule my patch if dirty_ratio one goes.
>

cool! We'll redo the patch then and lets make this work. We'll need to
see how many bits we need for section/node/zone to do pc_to_pfn() and
pfn_to_page().

-- 
	Three Cheers,
	Balbir

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  5:31           ` Balbir Singh
@ 2010-10-07  5:39             ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-10-07  5:39 UTC (permalink / raw)
  To: balbir; +Cc: linux-mm@kvack.org, containers, linux-kernel@vger.kernel.org

On Thu, 7 Oct 2010 11:01:17 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 13:22:33]:
> 
> > On Thu, 7 Oct 2010 09:26:08 +0530
> > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > 
> > > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 12:18:16]:
> > > 
> > > > On Thu, 7 Oct 2010 08:42:04 +0530
> > > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > > 
> > > > > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 08:58:58]:
> > > > > 
> > > > > > On Wed, 6 Oct 2010 19:53:14 +0530
> > > > > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > > > > 
> > > > > > > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > > > > > > same is below. Comments?
> > > > > > > 
> > > > > > > 
> > > > > > > Restrict the bits usage in page_cgroup.flags
> > > > > > > 
> > > > > > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > > > > 
> > > > > > > Restricting the flags helps control growth of the flags unbound.
> > > > > > > Restriciting it to 16 bits gives us the possibility of merging
> > > > > > > cgroup id with flags (atomicity permitting) and saving a whole
> > > > > > > long word in page_cgroup
> > > > > > > 
> > > > > > > Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > > > 
> > > > > > Doesn't make sense until you show the usage of existing bits.
> > > > > 
> > > > > ??
> > > > > 
> > > > Limiting something for NOT EXISTING PATCH doesn't make sense, in general.
> > > > 
> > > > 
> > > > > > And I guess 16bit may be too large on 32bit systems.
> > > > > 
> > > > > too large on 32 bit systems? My intention is to keep the flags to 16
> > > > > bits and then use cgroup id for the rest and see if we can remove
> > > > > mem_cgroup pointer
> > > > > 
> > > > 
> > > > You can't use flags field to store mem_cgroup_id while we use lock bit on it.
> > > > We have to store something more stable...as pfn or node-id or zone-id.
> > > > 
> > > > It's very racy. 
> > > >
> > > 
> > > Yes, correct it is racy, there is no easy way from what I know we can write
> > > the upper 16 bits of the flag without affecting the lower 16 bits, if
> > > the 16 bits are changing. One of the techniques could be to have lock
> > > for the unsigned long word itself - but I don't know what performance
> > > overhead that would add. Having said that I would like to explore
> > > techniques that allow me to merge the two.
> > > 
> > 
> > to store pfn, we need to limit under 12bit.
> > I'll schedule my patch if dirty_ratio one goes.
> >
> 
> cool! We'll redo the patch then and lets make this work. We'll need to
> see how many bits we need for section/node/zone to do pc_to_pfn() and
> pfn_to_page().
> 

As far as I know now,

!CONFIG_HIGHMEM -> we can store pfn.
CONFIG_HIGHMEM && CONFIG_SPARSEMEM -> we can store section
CONFIG_HIGHMEM && !CONFIG_SPARSEMEM -> we can store node-id
CONFIG_HIGHMEM && CONFIG_SPARSEMEM_VMEMMAP -> there is no arch.

I think we can do.

-Kame


--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC] Restrict size of page_cgroup->flags
  2010-10-07  4:22         ` KAMEZAWA Hiroyuki
  2010-10-07  5:31           ` Balbir Singh
@ 2010-10-07  5:44           ` Daisuke Nishimura
  1 sibling, 0 replies; 13+ messages in thread
From: Daisuke Nishimura @ 2010-10-07  5:44 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: balbir, linux-mm@kvack.org, containers,
	linux-kernel@vger.kernel.org, Daisuke Nishimura

On Thu, 7 Oct 2010 13:22:33 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> On Thu, 7 Oct 2010 09:26:08 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
> > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 12:18:16]:
> > 
> > > On Thu, 7 Oct 2010 08:42:04 +0530
> > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > 
> > > > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-10-07 08:58:58]:
> > > > 
> > > > > On Wed, 6 Oct 2010 19:53:14 +0530
> > > > > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > > > > 
> > > > > > I propose restricting page_cgroup.flags to 16 bits. The patch for the
> > > > > > same is below. Comments?
> > > > > > 
> > > > > > 
> > > > > > Restrict the bits usage in page_cgroup.flags
> > > > > > 
> > > > > > From: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > > > 
> > > > > > Restricting the flags helps control growth of the flags unbound.
> > > > > > Restriciting it to 16 bits gives us the possibility of merging
> > > > > > cgroup id with flags (atomicity permitting) and saving a whole
> > > > > > long word in page_cgroup
> > > > > > 
> > > > > > Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> > > > > 
> > > > > Doesn't make sense until you show the usage of existing bits.
> > > > 
> > > > ??
> > > > 
> > > Limiting something for NOT EXISTING PATCH doesn't make sense, in general.
> > > 
> > > 
> > > > > And I guess 16bit may be too large on 32bit systems.
> > > > 
> > > > too large on 32 bit systems? My intention is to keep the flags to 16
> > > > bits and then use cgroup id for the rest and see if we can remove
> > > > mem_cgroup pointer
> > > > 
> > > 
> > > You can't use flags field to store mem_cgroup_id while we use lock bit on it.
> > > We have to store something more stable...as pfn or node-id or zone-id.
> > > 
> > > It's very racy. 
> > >
> > 
> > Yes, correct it is racy, there is no easy way from what I know we can write
> > the upper 16 bits of the flag without affecting the lower 16 bits, if
> > the 16 bits are changing. One of the techniques could be to have lock
> > for the unsigned long word itself - but I don't know what performance
> > overhead that would add. Having said that I would like to explore
> > techniques that allow me to merge the two.
> > 
> 
> to store pfn, we need to limit under 12bit.
I'm sorry if I miss something, but is it valid in PAE case too ?
I think it would be better to store section id(or node id) rather than pfn.

> I'll schedule my patch if dirty_ratio one goes.
> 
Agreed. I think we should do dirty_ratio patches first.


Thanks,
Daisuke Nishimura.

--
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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-10-07  5:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 14:23 [RFC] Restrict size of page_cgroup->flags Balbir Singh
2010-10-06 23:58 ` KAMEZAWA Hiroyuki
2010-10-07  3:12   ` Balbir Singh
2010-10-07  3:18     ` KAMEZAWA Hiroyuki
2010-10-07  3:56       ` Balbir Singh
2010-10-07  4:22         ` KAMEZAWA Hiroyuki
2010-10-07  5:31           ` Balbir Singh
2010-10-07  5:39             ` KAMEZAWA Hiroyuki
2010-10-07  5:44           ` Daisuke Nishimura
2010-10-07  0:54 ` Daisuke Nishimura
2010-10-07  3:14   ` Balbir Singh
2010-10-07  3:47     ` Daisuke Nishimura
2010-10-07  4:08       ` Balbir Singh

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).