Re: [PATCH 4/4] mm, page_alloc: Only use per-cpu allocator for irq-safe requests
From: Mel Gorman
Date: Mon Jan 23 2017 - 06:18:12 EST
On Fri, Jan 20, 2017 at 04:02:56PM +0100, Vlastimil Babka wrote:
> On 01/17/2017 10:29 AM, Mel Gorman wrote:
>
> [...]
>
> > @@ -1244,10 +1243,8 @@ static void __free_pages_ok(struct page *page, unsigned int order)
> > return;
> >
> > migratetype = get_pfnblock_migratetype(page, pfn);
> > - local_irq_save(flags);
> > - __count_vm_events(PGFREE, 1 << order);
> > + count_vm_events(PGFREE, 1 << order);
>
> Maybe this could be avoided by moving the counting into free_one_page()?
> Diff suggestion at the end of e-mail.
>
Yes, that would work.
> > @@ -2472,16 +2470,20 @@ void free_hot_cold_page(struct page *page, bool cold)
> > {
> > struct zone *zone = page_zone(page);
> > struct per_cpu_pages *pcp;
> > - unsigned long flags;
> > unsigned long pfn = page_to_pfn(page);
> > int migratetype;
> >
> > if (!free_pcp_prepare(page))
> > return;
> >
> > + if (in_interrupt()) {
> > + __free_pages_ok(page, 0);
> > + return;
> > + }
>
> I think this should go *before* free_pcp_prepare() otherwise
> free_pages_prepare() gets done twice in interrupt.
>
You're right, thanks.
--
Mel Gorman
SUSE Labs