From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id A06BD6B025E for ; Fri, 2 Dec 2016 05:04:13 -0500 (EST) Received: by mail-wm0-f70.google.com with SMTP id i131so2127236wmf.3 for ; Fri, 02 Dec 2016 02:04:13 -0800 (PST) Received: from mail-wj0-f193.google.com (mail-wj0-f193.google.com. [209.85.210.193]) by mx.google.com with ESMTPS id c74si2299379wme.33.2016.12.02.02.04.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Dec 2016 02:04:12 -0800 (PST) Received: by mail-wj0-f193.google.com with SMTP id j10so2162643wjb.3 for ; Fri, 02 Dec 2016 02:04:12 -0800 (PST) Date: Fri, 2 Dec 2016 11:04:11 +0100 From: Michal Hocko Subject: Re: [PATCH 1/2] mm, page_alloc: Keep pcp count and list contents in sync if struct page is corrupted Message-ID: <20161202100411.GG6830@dhcp22.suse.cz> References: <20161202002244.18453-1-mgorman@techsingularity.net> <20161202002244.18453-2-mgorman@techsingularity.net> <01d601d24c4e$dca6e190$95f4a4b0$@alibaba-inc.com> <55e1d640-72cf-d7b5-695b-87863ca7a843@suse.cz> <01f201d24c7e$ac04ed40$040ec7c0$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01f201d24c7e$ac04ed40$040ec7c0$@alibaba-inc.com> Sender: owner-linux-mm@kvack.org List-ID: To: Hillf Danton Cc: 'Vlastimil Babka' , 'Mel Gorman' , 'Andrew Morton' , 'Christoph Lameter' , 'Johannes Weiner' , 'Jesper Dangaard Brouer' , 'Linux-MM' , 'Linux-Kernel' On Fri 02-12-16 17:30:07, Hillf Danton wrote: [...] > > >> @@ -2217,13 +2217,14 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, > > >> else > > >> list_add_tail(&page->lru, list); > > >> list = &page->lru; > > >> + alloced++; > > >> if (is_migrate_cma(get_pcppage_migratetype(page))) > > >> __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, > > >> -(1 << order)); > > >> } > > >> __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order)); > > > > > > Now i is a pure index, yes? > > > > No, even if a page fails the check_pcp_refill() check and is not > > "allocated", it is also no longer a free page, so it's correct to > > subtract it from NR_FREE_PAGES. > > > Yes, we can allocate free page next time. No we cannot. The page is gone from the free list. We have effectively leaked it. -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759778AbcLBKSG (ORCPT ); Fri, 2 Dec 2016 05:18:06 -0500 Received: from mail-wj0-f195.google.com ([209.85.210.195]:33157 "EHLO mail-wj0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759684AbcLBKSD (ORCPT ); Fri, 2 Dec 2016 05:18:03 -0500 Date: Fri, 2 Dec 2016 11:04:11 +0100 From: Michal Hocko To: Hillf Danton Cc: "'Vlastimil Babka'" , "'Mel Gorman'" , "'Andrew Morton'" , "'Christoph Lameter'" , "'Johannes Weiner'" , "'Jesper Dangaard Brouer'" , "'Linux-MM'" , "'Linux-Kernel'" Subject: Re: [PATCH 1/2] mm, page_alloc: Keep pcp count and list contents in sync if struct page is corrupted Message-ID: <20161202100411.GG6830@dhcp22.suse.cz> References: <20161202002244.18453-1-mgorman@techsingularity.net> <20161202002244.18453-2-mgorman@techsingularity.net> <01d601d24c4e$dca6e190$95f4a4b0$@alibaba-inc.com> <55e1d640-72cf-d7b5-695b-87863ca7a843@suse.cz> <01f201d24c7e$ac04ed40$040ec7c0$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01f201d24c7e$ac04ed40$040ec7c0$@alibaba-inc.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 02-12-16 17:30:07, Hillf Danton wrote: [...] > > >> @@ -2217,13 +2217,14 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, > > >> else > > >> list_add_tail(&page->lru, list); > > >> list = &page->lru; > > >> + alloced++; > > >> if (is_migrate_cma(get_pcppage_migratetype(page))) > > >> __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, > > >> -(1 << order)); > > >> } > > >> __mod_zone_page_state(zone, NR_FREE_PAGES, -(i << order)); > > > > > > Now i is a pure index, yes? > > > > No, even if a page fails the check_pcp_refill() check and is not > > "allocated", it is also no longer a free page, so it's correct to > > subtract it from NR_FREE_PAGES. > > > Yes, we can allocate free page next time. No we cannot. The page is gone from the free list. We have effectively leaked it. -- Michal Hocko SUSE Labs