From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754633AbcJLGyY (ORCPT ); Wed, 12 Oct 2016 02:54:24 -0400 Received: from outbound-smtp05.blacknight.com ([81.17.249.38]:40340 "EHLO outbound-smtp05.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754435AbcJLGxe (ORCPT ); Wed, 12 Oct 2016 02:53:34 -0400 Date: Wed, 12 Oct 2016 06:36:11 +0100 From: Mel Gorman To: Minchan Kim Cc: Andrew Morton , Vlastimil Babka , Joonsoo Kim , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sangseok Lee Subject: Re: [PATCH 2/4] mm: prevent double decrease of nr_reserved_highatomic Message-ID: <20161012053611.GB22174@techsingularity.net> References: <1475819136-24358-1-git-send-email-minchan@kernel.org> <1475819136-24358-3-git-send-email-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1475819136-24358-3-git-send-email-minchan@kernel.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 07, 2016 at 02:45:34PM +0900, Minchan Kim wrote: > There is race between page freeing and unreserved highatomic. > > CPU 0 CPU 1 > > free_hot_cold_page > mt = get_pfnblock_migratetype > 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. > > So, this patch verifies whether the pageblock is highatomic or not > and decrease the count only if the pageblock is highatomic. > > Signed-off-by: Minchan Kim Acked-by: Mel Gorman -- Mel Gorman SUSE Labs