public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Fengwei Yin <yfw.kernel@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: About get_page for compound page
Date: Fri, 20 Jul 2007 08:55:33 +0200	[thread overview]
Message-ID: <1184914533.20032.163.camel@twins> (raw)
In-Reply-To: <ab18d8520707191659l3c176429iee35d00817778711@mail.gmail.com>

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.


      reply	other threads:[~2007-07-20  6:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1184914533.20032.163.camel@twins \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yfw.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox