Skip to contentSkip to conversation

Restrict size of page_cgroup->flags

RFC In review Balbir Singh 6 participants 25 messages Oct 6, 2010 – Oct 7, 2010 10 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 Restrict size of page_cgroup->flags

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 <[email protected]>

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

---

 include/linux/page_cgroup.h |    3 +++
 mm/page_cgroup.c            |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)
include/linux/page_cgroup.h +3 -0
index 872f6b1..10c37b4 100644
@@ -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); }
mm/page_cgroup.c +1 -0
index 5bffada..e16ad2e 100644
@@ -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;
 
Signature · 8 lines
	Three Cheers,
	Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

A message that is not in the archive (sent off-list or not yet received): 20101006142314.GG4195-SINUvgVNF2CyUtPGxGje5AC/[email protected]

#2 lore raw
Quoted 6 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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

Quoted 8 lines

From: Balbir Singh <[email protected]>

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

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

#3 lore raw
In reply to a message not in the archive
Quoted 4 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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

Quoted 9 lines

Restrict the bits usage in page_cgroup.flags

From: Balbir Singh <[email protected]>

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.

Quoted 47 lines

---

 include/linux/page_cgroup.h |    3 +++
 mm/page_cgroup.c            |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)
include/linux/page_cgroup.h +3 -0
index 872f6b1..10c37b4 100644
@@ -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); }
mm/page_cgroup.c +1 -0
index 5bffada..e16ad2e 100644
@@ -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;
 
Signature · 9 lines
-- 
	Three Cheers,
	Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw
In reply to Balbir Singh
Quoted 6 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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

Quoted 8 lines

From: Balbir Singh <[email protected]>

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

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

A message that is not in the archive (sent off-list or not yet received): 20101007085858.0e07de59.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org

#6 lore raw
Quoted 11 lines · KAMEZAWA Hiroyuki
Quoted 8 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

Quoted 8 lines
Quoted 6 lines

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

Doesn't make sense until you show the usage of existing bits.

??

Quoted 1 line

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

Quoted 2 lines

Nack for now.

The issue is - do you see further growth of flags?

Quoted 3 lines

Thanks,
-Kame

Signature · 2 lines
	Three Cheers,
	Balbir
#7 lore raw
In reply to KAMEZAWA Hiroyuki
Quoted 11 lines · KAMEZAWA Hiroyuki
Quoted 8 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

Quoted 8 lines
Quoted 6 lines

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

Doesn't make sense until you show the usage of existing bits.

??

Quoted 1 line

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

Quoted 2 lines

Nack for now.

The issue is - do you see further growth of flags?

Quoted 3 lines

Thanks,
-Kame

Signature · 2 lines
	Three Cheers,
	Balbir

A message that is not in the archive (sent off-list or not yet received): 20101007031203.GK4195-SINUvgVNF2CyUtPGxGje5AC/[email protected]

#9 lore raw
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

#10 lore raw
In reply to Balbir Singh
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh <[email protected]>…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

A message that is not in the archive (sent off-list or not yet received): 20101007121816.bbd009c1.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org

#12 lore raw
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Signature · 2 lines
	Three Cheers,
	Balbir
#13 lore raw
In reply to KAMEZAWA Hiroyuki
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh <[email protected]>…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Signature · 2 lines
	Three Cheers,
	Balbir

A message that is not in the archive (sent off-list or not yet received): 20101007035608.GN4195-SINUvgVNF2CyUtPGxGje5AC/[email protected]

#15 lore raw
Quoted 45 lines · On Thu, 7 Oct 2010 09:26:08 +0530 Balbir Singh…
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Quoted 7 lines

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

#16 lore raw
In reply to Balbir Singh
Quoted 45 lines · On Thu, 7 Oct 2010 09:26:08 +0530 Balbir Singh <[email protected]>…
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh <[email protected]>…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Quoted 7 lines

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

A message that is not in the archive (sent off-list or not yet received): 20101007132233.f695aa2c.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org

#18 lore raw
Quoted 56 lines · KAMEZAWA Hiroyuki
Quoted 45 lines · On Thu, 7 Oct 2010 09:26:08 +0530 Balbir Singh…
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Quoted 7 lines

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.

Quoted 3 lines

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

Signature · 2 lines
	Three Cheers,
	Balbir
#19 lore raw
In reply to a message not in the archive
Quoted 56 lines · On Thu, 7 Oct 2010 13:22:33 +0900 KAMEZAWA Hiroyuki…
Quoted 45 lines · On Thu, 7 Oct 2010 09:26:08 +0530 Balbir Singh…
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Quoted 7 lines

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.

Quoted 1 line

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.

Quoted 2 lines

I'll schedule my patch if dirty_ratio one goes.

Agreed. I think we should do dirty_ratio patches first.

Thanks,
Daisuke Nishimura.

#20 lore raw
In reply to KAMEZAWA Hiroyuki
Quoted 56 lines · KAMEZAWA Hiroyuki
Quoted 45 lines · On Thu, 7 Oct 2010 09:26:08 +0530 Balbir Singh <[email protected]>…
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh <[email protected]>…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Quoted 7 lines

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.

Quoted 3 lines

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

Signature · 2 lines
	Three Cheers,
	Balbir

A message that is not in the archive (sent off-list or not yet received): 20101007053117.GQ4195-SINUvgVNF2CyUtPGxGje5AC/[email protected]

#22 lore raw
Quoted 58 lines · On Thu, 7 Oct 2010 11:01:17 +0530 Balbir Singh…
Quoted 56 lines · KAMEZAWA Hiroyuki
Quoted 52 lines · On Thu, 7 Oct 2010 09:26:08 +0530 Balbir Singh…
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Quoted 8 lines
Quoted 3 lines

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

#23 lore raw
In reply to Balbir Singh
Quoted 58 lines · On Thu, 7 Oct 2010 11:01:17 +0530 Balbir Singh <[email protected]>…
Quoted 56 lines · KAMEZAWA Hiroyuki
Quoted 52 lines · On Thu, 7 Oct 2010 09:26:08 +0530 Balbir Singh <[email protected]>…
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh <[email protected]>…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Quoted 8 lines
Quoted 3 lines

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#24 lore raw
In reply to KAMEZAWA Hiroyuki
Quoted 56 lines · On Thu, 7 Oct 2010 13:22:33 +0900 KAMEZAWA Hiroyuki…
Quoted 45 lines · On Thu, 7 Oct 2010 09:26:08 +0530 Balbir Singh <[email protected]>…
Quoted 37 lines · KAMEZAWA Hiroyuki
Quoted 18 lines · On Thu, 7 Oct 2010 08:42:04 +0530 Balbir Singh <[email protected]>…
Quoted 16 lines · KAMEZAWA Hiroyuki
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Doesn't make sense until you show the usage of existing bits.

??

Limiting something for NOT EXISTING PATCH doesn't make sense, in general.

Quoted 6 lines
Quoted 1 line

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

Quoted 5 lines

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.

Quoted 7 lines

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.

Quoted 1 line

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.

Quoted 2 lines

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#25 lore raw
In reply to Balbir Singh
Quoted 4 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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

Quoted 9 lines

Restrict the bits usage in page_cgroup.flags

From: Balbir Singh <[email protected]>

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.

Quoted 47 lines

---

 include/linux/page_cgroup.h |    3 +++
 mm/page_cgroup.c            |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)
include/linux/page_cgroup.h +3 -0
index 872f6b1..10c37b4 100644
@@ -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); }
mm/page_cgroup.c +1 -0
index 5bffada..e16ad2e 100644
@@ -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;
 
Signature · 9 lines
-- 
	Three Cheers,
	Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

A message that is not in the archive (sent off-list or not yet received): 20101007095458.a992969e.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org

#27 lore raw
Quoted 11 lines · * [email protected]…
Quoted 8 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

Quoted 8 lines
Quoted 5 lines

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?

Signature · 2 lines
	Three Cheers,
	Balbir
#28 lore raw
In reply to Daisuke Nishimura
Quoted 11 lines · * [email protected] <[email protected]> [2010-10-07…
Quoted 8 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

Quoted 8 lines
Quoted 5 lines

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?

Signature · 2 lines
	Three Cheers,
	Balbir

A message that is not in the archive (sent off-list or not yet received): 20101007031459.GL4195-SINUvgVNF2CyUtPGxGje5AC/[email protected]

#30 lore raw
Quoted 18 lines · On Thu, 7 Oct 2010 08:44:59 +0530 Balbir Singh…
Quoted 16 lines · * [email protected]…
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines

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.

#31 lore raw
In reply to Balbir Singh
Quoted 18 lines · On Thu, 7 Oct 2010 08:44:59 +0530 Balbir Singh <[email protected]>…
Quoted 16 lines · * [email protected] <[email protected]> [2010-10-07…
Quoted 13 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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 <[email protected]>

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

Quoted 6 lines
Quoted 3 lines

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

A message that is not in the archive (sent off-list or not yet received): 20101007124706.c602649e.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org

#33 lore raw
Quoted 25 lines · * [email protected]…
Quoted 22 lines · On Thu, 7 Oct 2010 08:44:59 +0530 Balbir Singh…
Quoted 19 lines · * [email protected]…
Quoted 4 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh…

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

Quoted 9 lines

Restrict the bits usage in page_cgroup.flags

From: Balbir Singh <[email protected]>

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 ?

Quoted 6 lines
Quoted 2 lines

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.

Signature · 2 lines
	Three Cheers,
	Balbir
#34 lore raw
In reply to Daisuke Nishimura
Quoted 25 lines · * [email protected] <[email protected]> [2010-10-07…
Quoted 22 lines · On Thu, 7 Oct 2010 08:44:59 +0530 Balbir Singh <[email protected]>…
Quoted 19 lines · * [email protected] <[email protected]> [2010-10-07…
Quoted 4 lines · On Wed, 6 Oct 2010 19:53:14 +0530 Balbir Singh <[email protected]>…

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

Quoted 9 lines

Restrict the bits usage in page_cgroup.flags

From: Balbir Singh <[email protected]>

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 ?

Quoted 6 lines
Quoted 2 lines

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.

Signature · 8 lines
	Three Cheers,
	Balbir

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>