Re: [PATCH 2/4] mm: prevent double decrease of nr_reserved_highatomic

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

 



On Fri, Oct 07, 2016 at 02:44:15PM +0200, Vlastimil Babka wrote:
> On 10/07/2016 07:45 AM, Minchan Kim wrote:
> >There is race between page freeing and unreserved highatomic.
> >
> > CPU 0				    CPU 1
> >
> >    free_hot_cold_page
> >      mt = get_pfnblock_migratetype
> 
> so here mt == MIGRATE_HIGHATOMIC?

Yes.

> 
> >      set_pcppage_migratetype(page, mt)
> >    				    unreserve_highatomic_pageblock
> >    				    spin_lock_irqsave(&zone->lock)
> >    				    move_freepages_block
> >    				    set_pageblock_migratetype(page)
> >    				    spin_unlock_irqrestore(&zone->lock)
> >      free_pcppages_bulk
> >        __free_one_page(mt) <- mt is stale
> >
> >By above race, a page on CPU 0 could go non-highorderatomic free list
> >since the pageblock's type is changed.
> >By that, unreserve logic of
> >highorderatomic can decrease reserved count on a same pageblock
> >several times and then it will make mismatch between
> >nr_reserved_highatomic and the number of reserved pageblock.
> 
> Hmm I see.
> 
> >So, this patch verifies whether the pageblock is highatomic or not
> >and decrease the count only if the pageblock is highatomic.
> 
> Yeah I guess that's the easiest solution.
> 
> >Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>
> 
> Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

Thanks, Vlastimil.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]