* [PATCH] fix page_reset_bad_cgroup
@ 2008-04-18 3:10 KAMEZAWA Hiroyuki
2008-04-18 3:22 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-04-18 3:10 UTC (permalink / raw)
To: LKML; +Cc: Andrew Morton, shiwh, balbir, xemul
page->page_cgroup is unsigned long. Should be cleared by 0UL.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Index: linux-2.6.25/include/linux/memcontrol.h
===================================================================
--- linux-2.6.25.orig/include/linux/memcontrol.h
+++ linux-2.6.25/include/linux/memcontrol.h
@@ -30,7 +30,7 @@ struct mm_struct;
extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p);
extern void mm_free_cgroup(struct mm_struct *mm);
-#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0)
+#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0UL)
extern struct page_cgroup *page_get_page_cgroup(struct page *page);
extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix page_reset_bad_cgroup
2008-04-18 3:10 [PATCH] fix page_reset_bad_cgroup KAMEZAWA Hiroyuki
@ 2008-04-18 3:22 ` Andrew Morton
2008-04-18 3:36 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-04-18 3:22 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki; +Cc: LKML, shiwh, balbir, xemul
On Fri, 18 Apr 2008 12:10:46 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> page->page_cgroup is unsigned long. Should be cleared by 0UL.
>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
>
> Index: linux-2.6.25/include/linux/memcontrol.h
> ===================================================================
> --- linux-2.6.25.orig/include/linux/memcontrol.h
> +++ linux-2.6.25/include/linux/memcontrol.h
> @@ -30,7 +30,7 @@ struct mm_struct;
> extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p);
> extern void mm_free_cgroup(struct mm_struct *mm);
>
> -#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0)
> +#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0UL)
That's pretty cosmetic.
In fact it could be argued that we shouldn't do this. "0" is zero
regardless of the type of the LHS. So if we later change page_cgroup to
u32 or u16 or `struct superblock *', the old page_reset_bad_cgroup() will
happily continue to work. There's no need to make this code aware of
page_cgroup's type, to this extent?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix page_reset_bad_cgroup
2008-04-18 3:22 ` Andrew Morton
@ 2008-04-18 3:36 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 3+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-04-18 3:36 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, shiwh, balbir, xemul
On Thu, 17 Apr 2008 20:22:21 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri, 18 Apr 2008 12:10:46 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > page->page_cgroup is unsigned long. Should be cleared by 0UL.
> >
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >
> >
> > Index: linux-2.6.25/include/linux/memcontrol.h
> > ===================================================================
> > --- linux-2.6.25.orig/include/linux/memcontrol.h
> > +++ linux-2.6.25/include/linux/memcontrol.h
> > @@ -30,7 +30,7 @@ struct mm_struct;
> > extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p);
> > extern void mm_free_cgroup(struct mm_struct *mm);
> >
> > -#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0)
> > +#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0UL)
>
> That's pretty cosmetic.
>
> In fact it could be argued that we shouldn't do this. "0" is zero
> regardless of the type of the LHS. So if we later change page_cgroup to
> u32 or u16 or `struct superblock *', the old page_reset_bad_cgroup() will
> happily continue to work. There's no need to make this code aware of
> page_cgroup's type, to this extent?
>
Ah, sorry. I was confused...please ignore.
(I debugged an user program which clear a pointer with 0, yesterday..)
-Kame
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-18 3:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-18 3:10 [PATCH] fix page_reset_bad_cgroup KAMEZAWA Hiroyuki
2008-04-18 3:22 ` Andrew Morton
2008-04-18 3:36 ` KAMEZAWA Hiroyuki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®