* [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
@ 2007-12-19 6:18 Balbir Singh
2007-12-19 17:14 ` Dave Hansen
0 siblings, 1 reply; 11+ messages in thread
From: Balbir Singh @ 2007-12-19 6:18 UTC (permalink / raw)
To: Hugh Dickins; +Cc: Balbir Singh, LKML, Andrew Morton
Based on the recommendation and observations of Hugh Dickins,
page_cgroup_assign_cgroup() is not required. This patch replaces it with
a VM_BUG_ON, so that we can catch them in free_hot_cold_page()
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -puN mm/page_alloc.c~memory-controller-move-to-bug-on-in-free_hot_cold_page mm/page_alloc.c
--- linux-2.6.24-rc5/mm/page_alloc.c~memory-controller-move-to-bug-on-in-free_hot_cold_page 2007-12-19 11:31:46.000000000 +0530
+++ linux-2.6.24-rc5-balbir/mm/page_alloc.c 2007-12-19 11:33:45.000000000 +0530
@@ -995,7 +995,7 @@ static void fastcall free_hot_cold_page(
if (!PageHighMem(page))
debug_check_no_locks_freed(page_address(page), PAGE_SIZE);
- page_assign_page_cgroup(page, NULL);
+ VM_BUG_ON(page_get_page_cgroup(page));
arch_free_page(page, 0);
kernel_map_pages(page, 1, 0);
_
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-19 6:18 [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page Balbir Singh
@ 2007-12-19 17:14 ` Dave Hansen
2007-12-20 13:14 ` Hugh Dickins
0 siblings, 1 reply; 11+ messages in thread
From: Dave Hansen @ 2007-12-19 17:14 UTC (permalink / raw)
To: Balbir Singh; +Cc: Hugh Dickins, LKML, Andrew Morton
On Wed, 2007-12-19 at 11:48 +0530, Balbir Singh wrote:
> diff -puN mm/page_alloc.c~memory-controller-move-to-bug-on-in-free_hot_cold_page mm/page_alloc.c
> --- linux-2.6.24-rc5/mm/page_alloc.c~memory-controller-move-to-bug-on-in-free_hot_cold_page 2007-12-19 11:31:46.000000000 +0530
> +++ linux-2.6.24-rc5-balbir/mm/page_alloc.c 2007-12-19 11:33:45.000000000 +0530
> @@ -995,7 +995,7 @@ static void fastcall free_hot_cold_page(
>
> if (!PageHighMem(page))
> debug_check_no_locks_freed(page_address(page), PAGE_SIZE);
> - page_assign_page_cgroup(page, NULL);
> + VM_BUG_ON(page_get_page_cgroup(page));
> arch_free_page(page, 0);
> kernel_map_pages(page, 1, 0);
Hi Balbir,
You generally want to do these like:
foo = page_assign_page_cgroup(page, NULL);
VM_BUG_ON(foo);
Some embedded people have been known to optimize kernel size like this:
#define VM_BUG_ON(x) do{}while(0)
-- Dave
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-19 17:14 ` Dave Hansen
@ 2007-12-20 13:14 ` Hugh Dickins
2007-12-20 13:51 ` Peter Zijlstra
0 siblings, 1 reply; 11+ messages in thread
From: Hugh Dickins @ 2007-12-20 13:14 UTC (permalink / raw)
To: Dave Hansen; +Cc: Balbir Singh, LKML, Andrew Morton
On Wed, 19 Dec 2007, Dave Hansen wrote:
> > --- linux-2.6.24-rc5/mm/page_alloc.c~memory-controller-move-to-bug-on-in-free_hot_cold_page 2007-12-19 11:31:46.000000000 +0530
> > +++ linux-2.6.24-rc5-balbir/mm/page_alloc.c 2007-12-19 11:33:45.000000000 +0530
> > @@ -995,7 +995,7 @@ static void fastcall free_hot_cold_page(
> >
> > if (!PageHighMem(page))
> > debug_check_no_locks_freed(page_address(page), PAGE_SIZE);
> > - page_assign_page_cgroup(page, NULL);
> > + VM_BUG_ON(page_get_page_cgroup(page));
> > arch_free_page(page, 0);
> > kernel_map_pages(page, 1, 0);
>
> Hi Balbir,
>
> You generally want to do these like:
>
> foo = page_assign_page_cgroup(page, NULL);
> VM_BUG_ON(foo);
>
> Some embedded people have been known to optimize kernel size like this:
>
> #define VM_BUG_ON(x) do{}while(0)
Balbir's patch looks fine to me: I don't get your point there, Dave.
Hugh
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-20 13:14 ` Hugh Dickins
@ 2007-12-20 13:51 ` Peter Zijlstra
2007-12-20 14:16 ` Hugh Dickins
0 siblings, 1 reply; 11+ messages in thread
From: Peter Zijlstra @ 2007-12-20 13:51 UTC (permalink / raw)
To: Hugh Dickins; +Cc: Dave Hansen, Balbir Singh, LKML, Andrew Morton
On Thu, 2007-12-20 at 13:14 +0000, Hugh Dickins wrote:
> On Wed, 19 Dec 2007, Dave Hansen wrote:
> > > --- linux-2.6.24-rc5/mm/page_alloc.c~memory-controller-move-to-bug-on-in-free_hot_cold_page 2007-12-19 11:31:46.000000000 +0530
> > > +++ linux-2.6.24-rc5-balbir/mm/page_alloc.c 2007-12-19 11:33:45.000000000 +0530
> > > @@ -995,7 +995,7 @@ static void fastcall free_hot_cold_page(
> > >
> > > if (!PageHighMem(page))
> > > debug_check_no_locks_freed(page_address(page), PAGE_SIZE);
> > > - page_assign_page_cgroup(page, NULL);
> > > + VM_BUG_ON(page_get_page_cgroup(page));
> > > arch_free_page(page, 0);
> > > kernel_map_pages(page, 1, 0);
> >
> > Hi Balbir,
> >
> > You generally want to do these like:
> >
> > foo = page_assign_page_cgroup(page, NULL);
> > VM_BUG_ON(foo);
> >
> > Some embedded people have been known to optimize kernel size like this:
> >
> > #define VM_BUG_ON(x) do{}while(0)
>
> Balbir's patch looks fine to me: I don't get your point there, Dave.
There was a lengthy discussion here:
http://lkml.org/lkml/2007/12/14/131
on the merit of debug statements with side effects. But looking at our
definition:
#ifdef CONFIG_DEBUG_VM
#define VM_BUG_ON(cond) BUG_ON(cond)
#else
#define VM_BUG_ON(condition) do { } while(0)
#endif
disabling CONFIG_DEBUG_VM breaks the code as proposed by Balbir in that
it will no longer acquire the reference.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-20 13:51 ` Peter Zijlstra
@ 2007-12-20 14:16 ` Hugh Dickins
2007-12-20 14:20 ` Peter Zijlstra
0 siblings, 1 reply; 11+ messages in thread
From: Hugh Dickins @ 2007-12-20 14:16 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Dave Hansen, Balbir Singh, LKML, Andrew Morton
On Thu, 20 Dec 2007, Peter Zijlstra wrote:
> On Thu, 2007-12-20 at 13:14 +0000, Hugh Dickins wrote:
> > On Wed, 19 Dec 2007, Dave Hansen wrote:
> > > > - page_assign_page_cgroup(page, NULL);
> > > > + VM_BUG_ON(page_get_page_cgroup(page));
> > >
> > > Hi Balbir,
> > >
> > > You generally want to do these like:
> > >
> > > foo = page_assign_page_cgroup(page, NULL);
> > > VM_BUG_ON(foo);
> > >
> > > Some embedded people have been known to optimize kernel size like this:
> > >
> > > #define VM_BUG_ON(x) do{}while(0)
> >
> > Balbir's patch looks fine to me: I don't get your point there, Dave.
>
> There was a lengthy discussion here:
> http://lkml.org/lkml/2007/12/14/131
>
> on the merit of debug statements with side effects.
Of course, but what's the relevance?
> But looking at our definition:
>
> #ifdef CONFIG_DEBUG_VM
> #define VM_BUG_ON(cond) BUG_ON(cond)
> #else
> #define VM_BUG_ON(condition) do { } while(0)
> #endif
>
> disabling CONFIG_DEBUG_VM breaks the code as proposed by Balbir in that
> it will no longer acquire the reference.
But what reference?
struct page_cgroup *page_get_page_cgroup(struct page *page)
{
return (struct page_cgroup *)
(page->page_cgroup & ~PAGE_CGROUP_LOCK);
}
I guess the issue is that often a "get" function has a complementary
"put" function, but this isn't one of them. Would page_page_cgroup
be a better name, perhaps? I don't know.
Hugh
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-20 14:16 ` Hugh Dickins
@ 2007-12-20 14:20 ` Peter Zijlstra
2007-12-20 16:24 ` Balbir Singh
0 siblings, 1 reply; 11+ messages in thread
From: Peter Zijlstra @ 2007-12-20 14:20 UTC (permalink / raw)
To: Hugh Dickins; +Cc: Dave Hansen, Balbir Singh, LKML, Andrew Morton
On Thu, 2007-12-20 at 14:16 +0000, Hugh Dickins wrote:
> On Thu, 20 Dec 2007, Peter Zijlstra wrote:
> > On Thu, 2007-12-20 at 13:14 +0000, Hugh Dickins wrote:
> > > On Wed, 19 Dec 2007, Dave Hansen wrote:
> > > > > - page_assign_page_cgroup(page, NULL);
> > > > > + VM_BUG_ON(page_get_page_cgroup(page));
> > > >
> > > > Hi Balbir,
> > > >
> > > > You generally want to do these like:
> > > >
> > > > foo = page_assign_page_cgroup(page, NULL);
> > > > VM_BUG_ON(foo);
> > > >
> > > > Some embedded people have been known to optimize kernel size like this:
> > > >
> > > > #define VM_BUG_ON(x) do{}while(0)
> > >
> > > Balbir's patch looks fine to me: I don't get your point there, Dave.
> >
> > There was a lengthy discussion here:
> > http://lkml.org/lkml/2007/12/14/131
> >
> > on the merit of debug statements with side effects.
>
> Of course, but what's the relevance?
>
> > But looking at our definition:
> >
> > #ifdef CONFIG_DEBUG_VM
> > #define VM_BUG_ON(cond) BUG_ON(cond)
> > #else
> > #define VM_BUG_ON(condition) do { } while(0)
> > #endif
> >
> > disabling CONFIG_DEBUG_VM breaks the code as proposed by Balbir in that
> > it will no longer acquire the reference.
>
> But what reference?
>
> struct page_cgroup *page_get_page_cgroup(struct page *page)
> {
> return (struct page_cgroup *)
> (page->page_cgroup & ~PAGE_CGROUP_LOCK);
> }
>
> I guess the issue is that often a "get" function has a complementary
> "put" function, but this isn't one of them. Would page_page_cgroup
> be a better name, perhaps? I don't know.
Ah, yes, I mistakenly assumed it was a reference get. In that case I
stand corrected and do not have any objections.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-20 14:20 ` Peter Zijlstra
@ 2007-12-20 16:24 ` Balbir Singh
2007-12-20 16:35 ` Dave Hansen
2007-12-20 17:12 ` Andrew Morton
0 siblings, 2 replies; 11+ messages in thread
From: Balbir Singh @ 2007-12-20 16:24 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: Hugh Dickins, Dave Hansen, LKML, Andrew Morton
Peter Zijlstra wrote:
> On Thu, 2007-12-20 at 14:16 +0000, Hugh Dickins wrote:
>> On Thu, 20 Dec 2007, Peter Zijlstra wrote:
>>> On Thu, 2007-12-20 at 13:14 +0000, Hugh Dickins wrote:
>>>> On Wed, 19 Dec 2007, Dave Hansen wrote:
>>>>>> - page_assign_page_cgroup(page, NULL);
>>>>>> + VM_BUG_ON(page_get_page_cgroup(page));
>>>>> Hi Balbir,
>>>>>
>>>>> You generally want to do these like:
>>>>>
>>>>> foo = page_assign_page_cgroup(page, NULL);
>>>>> VM_BUG_ON(foo);
>>>>>
>>>>> Some embedded people have been known to optimize kernel size like this:
>>>>>
>>>>> #define VM_BUG_ON(x) do{}while(0)
>>>> Balbir's patch looks fine to me: I don't get your point there, Dave.
>>> There was a lengthy discussion here:
>>> http://lkml.org/lkml/2007/12/14/131
>>>
>>> on the merit of debug statements with side effects.
>> Of course, but what's the relevance?
>>
>>> But looking at our definition:
>>>
>>> #ifdef CONFIG_DEBUG_VM
>>> #define VM_BUG_ON(cond) BUG_ON(cond)
>>> #else
>>> #define VM_BUG_ON(condition) do { } while(0)
>>> #endif
>>>
>>> disabling CONFIG_DEBUG_VM breaks the code as proposed by Balbir in that
>>> it will no longer acquire the reference.
>> But what reference?
>>
>> struct page_cgroup *page_get_page_cgroup(struct page *page)
>> {
>> return (struct page_cgroup *)
>> (page->page_cgroup & ~PAGE_CGROUP_LOCK);
>> }
>>
>> I guess the issue is that often a "get" function has a complementary
>> "put" function, but this isn't one of them. Would page_page_cgroup
>> be a better name, perhaps? I don't know.
>
> Ah, yes, I mistakenly assumed it was a reference get. In that case I
> stand corrected and do not have any objections.
>
I was going to say the same thing, page_get_page_cgroup() does not hold
any references. May be _get_ in the name is confusing.
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-20 16:24 ` Balbir Singh
@ 2007-12-20 16:35 ` Dave Hansen
2007-12-20 17:12 ` Andrew Morton
1 sibling, 0 replies; 11+ messages in thread
From: Dave Hansen @ 2007-12-20 16:35 UTC (permalink / raw)
To: balbir; +Cc: Peter Zijlstra, Hugh Dickins, LKML, Andrew Morton
On Thu, 2007-12-20 at 21:54 +0530, Balbir Singh wrote:
>
> I was going to say the same thing, page_get_page_cgroup() does not hold
> any references. May be _get_ in the name is confusing.
OK, you three had the entire conversation outing me before I even fot to
respond! :)
Yeah, I thought it was a refcount acquisition. Balbir, it's fine the
way it stands (except for the slightly confusing name).
-- Dave
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-20 16:24 ` Balbir Singh
2007-12-20 16:35 ` Dave Hansen
@ 2007-12-20 17:12 ` Andrew Morton
2007-12-20 17:21 ` Hugh Dickins
1 sibling, 1 reply; 11+ messages in thread
From: Andrew Morton @ 2007-12-20 17:12 UTC (permalink / raw)
To: balbir; +Cc: Peter Zijlstra, Hugh Dickins, Dave Hansen, LKML
On Thu, 20 Dec 2007 21:54:15 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> >> struct page_cgroup *page_get_page_cgroup(struct page *page)
> >> {
> >> return (struct page_cgroup *)
> >> (page->page_cgroup & ~PAGE_CGROUP_LOCK);
> >> }
> >>
> >> I guess the issue is that often a "get" function has a complementary
> >> "put" function, but this isn't one of them. Would page_page_cgroup
> >> be a better name, perhaps? I don't know.
> >
> > Ah, yes, I mistakenly assumed it was a reference get. In that case I
> > stand corrected and do not have any objections.
> >
>
> I was going to say the same thing, page_get_page_cgroup() does not hold
> any references. May be _get_ in the name is confusing.
It is a bit unconventional. page_cgroup()?
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-20 17:12 ` Andrew Morton
@ 2007-12-20 17:21 ` Hugh Dickins
2007-12-20 17:39 ` Balbir Singh
0 siblings, 1 reply; 11+ messages in thread
From: Hugh Dickins @ 2007-12-20 17:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: balbir, Peter Zijlstra, Dave Hansen, LKML
On Thu, 20 Dec 2007, Andrew Morton wrote:
> On Thu, 20 Dec 2007 21:54:15 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > I was going to say the same thing, page_get_page_cgroup() does not hold
> > any references. May be _get_ in the name is confusing.
>
> It is a bit unconventional. page_cgroup()?
Seems ideal to me
(though there is some argument for page_page_cgroup(), weird as it is).
Hugh
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page
2007-12-20 17:21 ` Hugh Dickins
@ 2007-12-20 17:39 ` Balbir Singh
0 siblings, 0 replies; 11+ messages in thread
From: Balbir Singh @ 2007-12-20 17:39 UTC (permalink / raw)
To: Hugh Dickins; +Cc: Andrew Morton, Peter Zijlstra, Dave Hansen, LKML
Hugh Dickins wrote:
> On Thu, 20 Dec 2007, Andrew Morton wrote:
>> On Thu, 20 Dec 2007 21:54:15 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>>> I was going to say the same thing, page_get_page_cgroup() does not hold
>>> any references. May be _get_ in the name is confusing.
>> It is a bit unconventional. page_cgroup()?
>
> Seems ideal to me
> (though there is some argument for page_page_cgroup(), weird as it is).
>
> Hugh
Sounds good to me as well, except that it sounds like a constructor :-)
I'll try and make the changes and submit a patch. I am in the middle of
losing control_type now (based on Hugh's comments)
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-12-20 17:40 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-19 6:18 [PATCH] Move page_assign_page_cgroup to VM_BUG_ON in free_hot_cold_page Balbir Singh
2007-12-19 17:14 ` Dave Hansen
2007-12-20 13:14 ` Hugh Dickins
2007-12-20 13:51 ` Peter Zijlstra
2007-12-20 14:16 ` Hugh Dickins
2007-12-20 14:20 ` Peter Zijlstra
2007-12-20 16:24 ` Balbir Singh
2007-12-20 16:35 ` Dave Hansen
2007-12-20 17:12 ` Andrew Morton
2007-12-20 17:21 ` Hugh Dickins
2007-12-20 17:39 ` 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).