Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp319633imm; Wed, 22 Aug 2018 04:56:11 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx+b8QLNYGKL/Wkm8jye2zjlesgGQiwErTJVDWu00O99pPNzECv/g8zCqi+iPOAUxu9LLej X-Received: by 2002:a62:c218:: with SMTP id l24-v6mr57612160pfg.185.1534938971658; Wed, 22 Aug 2018 04:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534938971; cv=none; d=google.com; s=arc-20160816; b=Bjw/EK1HaLdu8TbvE1y3xJfzc0fSXoKXxJQreSaeVc9yRCwdJoh4D6hYRpaTawqApj nhzW2C+Rs6HXLZx2DKy+H+89LZs8/vazrU7YoMjGe6VekAqksfcfHvSRRdsdWHPQM/HY //dFNvhEJUnVRXNQwGI8fF0hXoSyfXqjl1k6Bwc97BHe3cGElkz1m6AzuHDFwLqJhIuX 5OdQ+ORNEqGxl8giNKswErmfjQVSDmaPn7VnjqQWvL3b0ebPJAZdKc2kDAT0PzAQunjc HDbUSiSfz+NCxK7lwc07z5vqa20Dn3F6DNpd9U8kqh0udn71IGfG7glEEu5gk2PzW+wm eXZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=GnT/y/+IOm6AC8Dmkaxo9V0+6rGLmqDZ0nigZXiJyWM=; b=HY3AZQ1L2410Zkmos15s9v8RoSdkv9WMPpt0RmMWGOyNDLr6Hx2fKp+Qg/rS0rH+Qp Jo16HNfG+ZIEozTj4LrLrxCpVfhEQiNsy03IF0xYTDVAvb+4dYlcfWpJZqpQzP/T3qJO 5OOSihO44lYz3WAGm6HprSJW0SK/2sPW/jMnFqOWjlWfm/ZMWttwnO02xyGmraDK7yVS wRzkNGqhzfB24Gl+65Bfl44Gva1UJ6IxRg5f9H/KW/tSRB/kkw6y33KjaKNSuA80yeeD iGGP69CVIhRZDi/xjsA4dSQlj7ayj2CI4AW305I79vVfKL0DZLKd40CZFjXK3t5V7uvr rMCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9-v6si1429948pgf.599.2018.08.22.04.55.54; Wed, 22 Aug 2018 04:56:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728714AbeHVOSW (ORCPT + 99 others); Wed, 22 Aug 2018 10:18:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:54458 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728234AbeHVOSW (ORCPT ); Wed, 22 Aug 2018 10:18:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6756AACD0; Wed, 22 Aug 2018 10:53:57 +0000 (UTC) Date: Wed, 22 Aug 2018 12:53:55 +0200 From: Michal Hocko To: "Aneesh Kumar K.V" Cc: Haren Myneni , n-horiguchi@ah.jp.nec.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kamezawa.hiroyu@jp.fujitsu.com, mgorman@suse.de Subject: Re: Infinite looping observed in __offline_pages Message-ID: <20180822105355.GI29735@dhcp22.suse.cz> References: <20180725181115.hmlyd3tmnu3mn3sf@p50.austin.ibm.com> <20180725200336.GP28386@dhcp22.suse.cz> <87bm9ug34l.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bm9ug34l.fsf@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 22-08-18 15:00:18, Aneesh Kumar K.V wrote: > > Hi Michal, > > Michal Hocko writes: > > > On Wed 25-07-18 13:11:15, John Allen wrote: > > [...] > >> Does a failure in do_migrate_range indicate that the range is unmigratable > >> and the loop in __offline_pages should terminate and goto failed_removal? Or > >> should we allow a certain number of retrys before we > >> give up on migrating the range? > > > > Unfortunatelly not. Migration code doesn't tell a difference between > > ephemeral and permanent failures. We are relying on > > start_isolate_page_range to tell us this. So the question is, what kind > > of page is not migratable and for what reason. > > > > Are you able to add some debugging to give us more information. The > > current debugging code in the hotplug/migration sucks... > > Haren did most of the debugging, so at minimum we need a patch like this > I guess. > > modified mm/page_alloc.c > @@ -7649,6 +7649,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, > * handle each tail page individually in migration. > */ > if (PageHuge(page)) { > + > + if (!IS_ENABLED(CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION)) > + goto unmovable; > + > iter = round_up(iter + 1, 1< continue; > } > > > The problem is start_isolate_range, doesn't look at hugetlbpage and > return error if the architecture didn't support HUGEPAGE migration. Yes this makes sense. I didn't really have arches without huge page migration in mind. > Now discussing with Naoya, I was suggsting whether we should add a > similar check in > > modified mm/memory_hotplug.c > @@ -1338,7 +1338,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end) > return pfn; > if (__PageMovable(page)) > return pfn; > - if (PageHuge(page)) { > + if (IS_ENABLED(CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION) && > + PageHuge(page)) { > if (page_huge_active(page)) > return pfn; > > One of the thinking there is it possible to get new hugetlb pages > allocated in that range after start_isolate_range ran. But i guess since > we marked all the free pages as MIGRATE_ISOLATE that is not possible? I do not follow. You are usually allocating new pages outside of the offlined range. But the above change makes sense because it doesn't really make sense to migrate pfn if it is backed by a non-migrateable huge page. dissolve_free_huge_pages should then try to remove it completely and the offlining fails if that is not possible. > But then it is good to have scan_movable_pages also check for > HUGEPAGE_MIGRATION? Good question. It is not necessary right now because has_unmovable_pages called earlier should take care of it. But I guess it will not hurt to have it there as well for the clarity. > > Complete patch below. > > commit 2e9d754ac211f2af3731f15df3cd8cd070b4cc54 > Author: Aneesh Kumar K.V > Date: Tue Aug 21 14:17:55 2018 +0530 > > mm/hugetlb: filter out hugetlb pages if HUGEPAGE migration is not supported. > > When scanning for movable pages, filter out Hugetlb pages if hugepage migration > is not supported. Without this we hit infinte loop in __offline pages where we > do > pfn = scan_movable_pages(start_pfn, end_pfn); > if (pfn) { /* We have movable pages */ > ret = do_migrate_range(pfn, end_pfn); > goto repeat; > } > > We do support hugetlb migration ony if the hugetlb pages are at pmd level. Here > we just check for Kernel config. The gigantic page size check is done in > page_huge_active. That being said. The patch makes sense to me. > > Reported-by: Haren Myneni > CC: Naoya Horiguchi > Signed-off-by: Aneesh Kumar K.V I guess we should mark it for stable even though I am not sure how often do we see CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION=n Acked-by: Michal Hocko > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 4eb6e824a80c..f9bdea685cf4 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -1338,7 +1338,8 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end) > return pfn; > if (__PageMovable(page)) > return pfn; > - if (PageHuge(page)) { > + if (IS_ENABLED(CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION) && > + PageHuge(page)) { > if (page_huge_active(page)) > return pfn; > else > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 15ea511fb41c..a3f81e18c882 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7649,6 +7649,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, > * handle each tail page individually in migration. > */ > if (PageHuge(page)) { > + > + if (!IS_ENABLED(CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION)) > + goto unmovable; > + > iter = round_up(iter + 1, 1< continue; > } -- Michal Hocko SUSE Labs