Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp831228imu; Tue, 20 Nov 2018 07:37:18 -0800 (PST) X-Google-Smtp-Source: AJdET5dsbV8cBjEtuf4txwEgvDhp84sF66apWk0d8WYxklvPo0W82L5XZbXQXUrsveC7ZI7uayJN X-Received: by 2002:a62:520b:: with SMTP id g11mr2689715pfb.53.1542728238259; Tue, 20 Nov 2018 07:37:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542728238; cv=none; d=google.com; s=arc-20160816; b=gl1pm45CFEVzxnb5I+jxY9jmVuTgz76/Skw8UP8hU0l5g0LTdJojOzd0TwG55GZ5Gp aI6XqSS8fp/XDBoSH/9WPQmFqXliETj7CZ5EGMvWwXxjjkc5MormkFKQ8vxrdhoxmoEs GkBAdmBw6ZfWhyglL1n1rrF27JE46c+1Wk4OKxXNbm1EOXYJx1F5AflEWSOWAjm7YHXI u4wTorGQsPVdHduwq69yXhpqSmCAndzOtznmgevkGW6z1oOwl9d11vVpaNwC2BXVTfvU bSmPA5XntVassezUs4zUdpQWzs2CN766sZQbmDLK7Ig4Or4JIeZrU8spCM/MwlDUDei4 Su2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=KEuoImN74Qkt/Lfdef36CtIdd9/+hsvDdQKA7CQOE+A=; b=FyB6r2oxGJ4mj6oKpwLhtPDjfzYjX0FKswD7fN2ncLs1nKoXxCe8oGHLpjw08sOOlo MADld6vhLYT/YXXgacLi/hlIjiSaNwTgpY9u47iCOhdE7hLMVchOXsSl5hU+oSvZWUJ9 xUkczwmH8wW0uxgu+0wV0JfY3c4d3XSZSzRKupxnQfIoKNTeF6MXCjTxy5n2iDbGo6Ro sa9NnKactsGl7M1hatVlBtM2RtT+I2TkuPIOxkwAlFJclwYREBZFWy8iKyVRhNz6EixC WO0HNI4ydIgqBdzbRuhJCsyZU+FI544jjXX9T+IE5CS6NEyDTtN5fsZLGrADBFOnFdPS 40yg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9-v6si47732004plg.177.2018.11.20.07.37.03; Tue, 20 Nov 2018 07:37:18 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727193AbeKUCEU (ORCPT + 99 others); Tue, 20 Nov 2018 21:04:20 -0500 Received: from smtp.nue.novell.com ([195.135.221.5]:35797 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbeKUCEU (ORCPT ); Tue, 20 Nov 2018 21:04:20 -0500 Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 20 Nov 2018 16:34:36 +0100 Received: from [149.44.172.157] (nwb-a10-snat.microfocus.com [10.120.13.201]) by emea4-mta.ukb.novell.com with ESMTP (TLS encrypted); Tue, 20 Nov 2018 15:13:52 +0000 Message-ID: <1542726815.6817.8.camel@suse.com> Subject: Re: [RFC PATCH 2/3] mm, memory_hotplug: deobfuscate migration part of offlining From: osalvador To: Michal Hocko , linux-mm@kvack.org Cc: Andrew Morton , Pavel Tatashin , David Hildenbrand , LKML , Michal Hocko Date: Tue, 20 Nov 2018 16:13:35 +0100 In-Reply-To: <20181120134323.13007-3-mhocko@kernel.org> References: <20181120134323.13007-1-mhocko@kernel.org> <20181120134323.13007-3-mhocko@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Signed-off-by: Michal Hocko [...] > + do { > + for (pfn = start_pfn; pfn;) > + { > + /* start memory hot removal */ Should we change thAT comment? I mean, this is not really the hot- removal stage. Maybe "start memory migration" suits better? or memory offlining? > + ret = -EINTR; > + if (signal_pending(current)) { > + reason = "signal backoff"; > + goto failed_removal_isolated; > + } > > - cond_resched(); > - lru_add_drain_all(); > - drain_all_pages(zone); > + cond_resched(); > + lru_add_drain_all(); > + drain_all_pages(zone); > > - pfn = scan_movable_pages(start_pfn, end_pfn); > - if (pfn) { /* We have movable pages */ > - ret = do_migrate_range(pfn, end_pfn); > - goto repeat; > - } > + pfn = scan_movable_pages(pfn, end_pfn); > + if (pfn) { > + /* TODO fatal migration failures > should bail out */ > + do_migrate_range(pfn, end_pfn); > + } > + } > + > + /* > + * dissolve free hugepages in the memory block > before doing offlining > + * actually in order to make hugetlbfs's object > counting consistent. > + */ > + ret = dissolve_free_huge_pages(start_pfn, end_pfn); > + if (ret) { > + reason = "failure to dissolve huge pages"; > + goto failed_removal_isolated; > + } > + /* check again */ > + offlined_pages = check_pages_isolated(start_pfn, > end_pfn); > + } while (offlined_pages < 0); > > - /* > - * dissolve free hugepages in the memory block before doing > offlining > - * actually in order to make hugetlbfs's object counting > consistent. > - */ > - ret = dissolve_free_huge_pages(start_pfn, end_pfn); > - if (ret) { > - reason = "failure to dissolve huge pages"; > - goto failed_removal_isolated; > - } > - /* check again */ > - offlined_pages = check_pages_isolated(start_pfn, end_pfn); > - if (offlined_pages < 0) > - goto repeat; This indeed looks much nicer and it is easier to follow. With the changes commented by David: Reviewed-by: Oscar Salvador