Re: About get_page for compound page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/20/07, Peter Zijlstra <[email protected]> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux