* About get_page for compound page
@ 2007-07-19 15:54 Fengwei Yin
2007-07-19 21:39 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: Fengwei Yin @ 2007-07-19 15:54 UTC (permalink / raw)
To: LKML
Hi,
In get_page(), the parameter page is changed by
page = compound_head(page);
if the page is not the first page of compound pages.
My question: is this behavior correct?
Regards
Yin, Fengwei
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: About get_page for compound page
2007-07-19 15:54 About get_page for compound page Fengwei Yin
@ 2007-07-19 21:39 ` Peter Zijlstra
2007-07-19 23:59 ` Fengwei Yin
0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2007-07-19 21:39 UTC (permalink / raw)
To: Fengwei Yin; +Cc: LKML
On Thu, 2007-07-19 at 23:54 +0800, Fengwei Yin wrote:
> Hi,
> In get_page(), the parameter page is changed by
> page = compound_head(page);
> if the page is not the first page of compound pages.
>
> My question: is this behavior correct?
Yes it is, in general the page state of a compound page is kept in the
first page of the set.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: About get_page for compound page
2007-07-19 21:39 ` Peter Zijlstra
@ 2007-07-19 23:59 ` Fengwei Yin
2007-07-20 6:55 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: Fengwei Yin @ 2007-07-19 23:59 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: LKML
On 7/20/07, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, 2007-07-19 at 23:54 +0800, Fengwei Yin wrote:
> > Hi,
> > In get_page(), the parameter page is changed by
> > page = compound_head(page);
> > if the page is not the first page of compound pages.
> >
> > My question: is this behavior correct?
>
> Yes it is, in general the page state of a compound page is kept in the
> first page of the set.
>
Yes. I know this. But
static inline void get_page(struct page *page)
~~~~~~ changed by
this function.
{
page = compound_head(page);
~~~~~~~~~~~~~~~~~~~~~~~
VM_BUG_ON(atomic_read(&page->_count) == 0);
atomic_inc(&page->_count);
}
As I understand, just need update the first page reference count.
Or the caller aware of this bahavior?
Or change it to
static inline void get_page(struct page *page)
{
struct page *head_page = compound_head(page);
VM_BUG_ON(atomic_read(&head_page->_count) == 0);
atomic_inc(&head_page->_count);
}
Regards
Yin, Fengwei
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: About get_page for compound page
2007-07-19 23:59 ` Fengwei Yin
@ 2007-07-20 6:55 ` Peter Zijlstra
0 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2007-07-20 6:55 UTC (permalink / raw)
To: Fengwei Yin; +Cc: LKML
On Fri, 2007-07-20 at 07:59 +0800, Fengwei Yin wrote:
> On 7/20/07, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Thu, 2007-07-19 at 23:54 +0800, Fengwei Yin wrote:
> > > Hi,
> > > In get_page(), the parameter page is changed by
> > > page = compound_head(page);
> > > if the page is not the first page of compound pages.
> > >
> > > My question: is this behavior correct?
> >
> > Yes it is, in general the page state of a compound page is kept in the
> > first page of the set.
> >
> Yes. I know this. But
> static inline void get_page(struct page *page)
> ~~~~~~ changed by
> this function.
> {
> page = compound_head(page);
> ~~~~~~~~~~~~~~~~~~~~~~~
> VM_BUG_ON(atomic_read(&page->_count) == 0);
> atomic_inc(&page->_count);
> }
>
> As I understand, just need update the first page reference count.
> Or the caller aware of this bahavior?
>
> Or change it to
> static inline void get_page(struct page *page)
> {
> struct page *head_page = compound_head(page);
> VM_BUG_ON(atomic_read(&head_page->_count) == 0);
> atomic_inc(&head_page->_count);
> }
Arguments are local to the function.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-20 6:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-19 15:54 About get_page for compound page Fengwei Yin
2007-07-19 21:39 ` Peter Zijlstra
2007-07-19 23:59 ` Fengwei Yin
2007-07-20 6:55 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox