Skip to contentSkip to conversation

About get_page for compound page

DISCUSSION Fengwei Yin 2 participants 4 messages Jul 19, 2007 – Jul 20, 2007

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 6 lines · Fengwei Yin

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.

#2 lore raw
Quoted 11 lines · Peter Zijlstra
Quoted 6 lines · Fengwei Yin

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

#3 lore raw
Quoted 26 lines · Fengwei Yin
Quoted 11 lines · Peter Zijlstra
Quoted 6 lines · Fengwei Yin

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?

Quoted 7 lines

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.