[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <OF137D0ABE.5A739596-ON48257B50.002AB95E-48257B50.002AD807@zte.com.cn>
Date: Wed, 17 Apr 2013 15:47:23 +0800
From: zhang.yi20@....com.cn
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Darren Hart <dvhart@...ux.intel.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: Re: [PATCH] futex: bugfix for futex-key conflict when futex use
hugepage
Dave Hansen <dave.hansen@...ux.intel.com> wrote on 2013/04/17 02:37:40:
> Instead of bothering to store the index, why not just calculate it,
like:
>
> On 04/15/2013 08:37 PM, zhang.yi20@....com.cn wrote:
> > +static inline int get_page_compound_index(struct page *page)
> > +{
> > + if (PageHead(page))
> > + return 0;
> > + return compound_head(page) - page;
> > +}
>
> BTW, you've really got to get your mail client fixed. Your patch is
> still line-wrapped.
I agree that I should calculate the compound index, but refer to
prep_compound_gigantic_page, I think it may like this:
+static inline int get_page_compound_index(struct page *page)
+{
+ struct page *head_page;
+ if (PageHead(page))
+ return 0;
+
+ head_page = compound_head(page);
+ if (compound_order(head_page) >= MAX_ORDER)
+ return page_to_pfn(page) - page_to_pfn(head_page);
+ else
+ return page - compound_head(page);
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists