Re: [PATCH 3/4] mm, page_allocator: Only use per-cpu allocator for irq-safe requests

From: Mel Gorman
Date: Mon Jan 09 2017 - 04:48:09 EST


On Mon, Jan 09, 2017 at 11:14:29AM +0800, Hillf Danton wrote:
> > Sent: Friday, January 06, 2017 6:16 PM Mel Gorman wrote:
> >
> > On Fri, Jan 06, 2017 at 11:26:46AM +0800, Hillf Danton wrote:
> > >
> > > On Wednesday, January 04, 2017 7:11 PM Mel Gorman wrote:
> > > > @@ -2647,9 +2644,8 @@ static struct page *rmqueue_pcplist(struct zone *preferred_zone,
> > > > struct list_head *list;
> > > > bool cold = ((gfp_flags & __GFP_COLD) != 0);
> > > > struct page *page;
> > > > - unsigned long flags;
> > > >
> > > > - local_irq_save(flags);
> > > > + preempt_disable();
> > > > pcp = &this_cpu_ptr(zone->pageset)->pcp;
> > > > list = &pcp->lists[migratetype];
> > > > page = __rmqueue_pcplist(zone, order, gfp_flags, migratetype,
> > > > @@ -2658,7 +2654,7 @@ static struct page *rmqueue_pcplist(struct zone *preferred_zone,
> > > > __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order);
> > > > zone_statistics(preferred_zone, zone, gfp_flags);
> > > > }
> > > > - local_irq_restore(flags);
> > > > + preempt_enable();
> > > > return page;
> > > > }
> > > >
> > > With PREEMPT configured, preempt_enable() adds entry point to schedule().
> > > Is that needed when we try to allocate a page?
> > >
> >
> > Not necessarily but what are you proposing as an alternative?
>
> preempt_enable_no_resched() looks at first glance a choice for us to
> avoid flipping interrupts.
>

Ok, I wasn't sure if you were proposing something more drastic. I can
make it this although I have no reason to believe it will really matter.
The path should be short enough that it's unlikely a scheduler event
would ever occur at that point. Still, no harm in doing what you
suggest.

Thanks.

--
Mel Gorman
SUSE Labs