Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754491AbdDJQCp (ORCPT ); Mon, 10 Apr 2017 12:02:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:42043 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753776AbdDJQCn (ORCPT ); Mon, 10 Apr 2017 12:02:43 -0400 Date: Mon, 10 Apr 2017 18:02:28 +0200 From: Michal Hocko To: Igor Mammedov Cc: linux-mm@kvack.org, Andrew Morton , Mel Gorman , Vlastimil Babka , Andrea Arcangeli , Jerome Glisse , Reza Arbab , Yasuaki Ishimatsu , qiuxishi@huawei.com, Kani Toshimitsu , slaoub@gmail.com, Joonsoo Kim , Andi Kleen , David Rientjes , Daniel Kiper , Vitaly Kuznetsov , LKML , Dan Williams , Heiko Carstens , Lai Jiangshan , Martin Schwidefsky , Tobias Regnery Subject: Re: [PATCH -v2 0/9] mm: make movable onlining suck less Message-ID: <20170410160228.GI4618@dhcp22.suse.cz> References: <20170410110351.12215-1-mhocko@kernel.org> <20170410162749.7d7f31c1@nial.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170410162749.7d7f31c1@nial.brq.redhat.com> 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 Content-Length: 2582 Lines: 76 On Mon 10-04-17 16:27:49, Igor Mammedov wrote: [...] > #issue3: > removable flag flipped to non-removable state > > // before series at commit ef0b577b6: > memory32:offline removable: 0 zones: Normal Movable > memory33:offline removable: 0 zones: Normal Movable > memory34:offline removable: 0 zones: Normal Movable > memory35:offline removable: 0 zones: Normal Movable did you mean _after_ the series because the bellow looks like the original behavior (at least valid_zones). > // after series at commit 6a010434 > memory32:offline removable: 1 zones: Normal > memory33:offline removable: 1 zones: Normal > memory34:offline removable: 1 zones: Normal > memory35:offline removable: 1 zones: Normal Movable > > also looking at #issue1 removable flag state doesn't > seem to be consistent between state changes but maybe that's > been broken before Well, the file has a very questionable semantic. It doesn't provide a stable information. Anyway put that aside. is_pageblock_removable_nolock relies on having zone association which we do not have yet if the memblock is offline. So we need the following. I will queue this as a preparatory patch. --- >From 4f3ebc02f4d552d3fe114787ca8a38cc68702208 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Mon, 10 Apr 2017 17:59:03 +0200 Subject: [PATCH] mm, memory_hotplug: consider offline memblocks removable is_pageblock_removable_nolock relies on having zone association to examine all the page blocks to check whether they are movable or free. This is just wasting of cycles when the memblock is offline. Later patch in the series will also change the time when the page is associated with a zone so we let's bail out early if the memblock is offline. Reported-by: Igor Mammedov Signed-off-by: Michal Hocko --- drivers/base/memory.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 9677b6b711b0..0c29ec5598ea 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -128,6 +128,9 @@ static ssize_t show_mem_removable(struct device *dev, int ret = 1; struct memory_block *mem = to_memory_block(dev); + if (mem->stat != MEM_ONLINE) + goto out; + for (i = 0; i < sections_per_block; i++) { if (!present_section_nr(mem->start_section_nr + i)) continue; @@ -135,6 +138,7 @@ static ssize_t show_mem_removable(struct device *dev, ret &= is_mem_section_removable(pfn, PAGES_PER_SECTION); } +out: return sprintf(buf, "%d\n", ret); } -- 2.11.0 -- Michal Hocko SUSE Labs