Received: by 10.213.65.68 with SMTP id h4csp3760437imn; Tue, 10 Apr 2018 04:23:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/UPH+6Se8d2QDywTUm1C7QI9rvn9GUwzMd5LipHGLaIoS37tYMsMwpZqtsX5U9vmlXH253 X-Received: by 2002:a17:902:728f:: with SMTP id d15-v6mr2151640pll.119.1523359422261; Tue, 10 Apr 2018 04:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523359422; cv=none; d=google.com; s=arc-20160816; b=LS1mjF0/1UNka7oTuVvVGmS765ynJFk5Cv6c3pIUKtEK9jBTEcR1AEFrpMPTujksUb dulE/Z1vKhwGDI4jc6zYMptOzRafhWnBsNwSa0zyRTNQCqWRRX4yjQmGlIMbXFa/pBwY P16U6YuinOkFCFTMaGlRAP7Ww0D25vl9owvubmgEZ02d1ImUiCGpu+lIBQY6kznc739Q tmuRg0512+x6XYdHcjs1bYKtQYiaGz3LznU1FUDQzfoiihS7xX8fqusvoWC2rbQyJj1e +fxTVsIHT1dOQt749uLyJth5g4y+YdR5AeOUhAw1O8PMFb4uEgDrOv2APjwMd4AA/mNC EPyA== 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:dkim-signature:arc-authentication-results; bh=mZDBo1yQefb081IJmAm2imQZuQ/WPjhUva3qUXXrgCI=; b=0WQIRrjrN0QNpvsGKdafzxC1NtoP4XEgkzPFsfqmiU506op2Z0/lWDtaHTZm5SSQhl TqahnCqUUjgve1e3KVXYtT0c/m1Sl8NU08ZLh8VHADRcNKgR9BmmUUofXBG6Bvmt/9u+ J8343h6Ul3H4eF9XD4iCE8Y5a+N/J59GGS6X3/wRaJonYxypyt+Srlg++TWm5i9tvChD RWFcyrjb8CZXlpw/5xm5hd+aw8BWoHPZlNzcQYeMw3E4MaayHyoLrrk8dJp7hqLZFUOy VOBH+0bJ4wYQUCZ5azWyvwMBK+fdagOHtbVUWEv3IN8mBFnftBYHjqb4Kuvmis4TW9dV rGlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=mVIl+aaz; 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 a3-v6si2417890pld.167.2018.04.10.04.23.04; Tue, 10 Apr 2018 04:23:42 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=mVIl+aaz; 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 S1752428AbeDJLRW (ORCPT + 99 others); Tue, 10 Apr 2018 07:17:22 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:32954 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbeDJLRV (ORCPT ); Tue, 10 Apr 2018 07:17:21 -0400 Received: by mail-wm0-f66.google.com with SMTP id o23so21221730wmf.0 for ; Tue, 10 Apr 2018 04:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mZDBo1yQefb081IJmAm2imQZuQ/WPjhUva3qUXXrgCI=; b=mVIl+aazX7sMoGub+DxVrrqIDcY5lCFJcOdynTUvRphWxGdKD3otwTf2CjazabowKr rXCQ/jp8mTPDpsxHEVaJyf2hm0WTAxOLZOhIRjjGFdKbg1qJOnACUFWDw2E0dckZWy/1 bSu3XmQ641WiEd5Vb5O63WpZ9QhK5Cxqhd5YqXfolHzlq3IAwj9by3sOVkQ/dqyl+D+O JbjpjCkjVWgbqC3Pl7dRtOL7/TGb/JSiY9S0MmFRC0L1U14f7FoW12xtXu1jK7TuuhAg R1vrwLMfG0vaG/9L/iIhpVQgDqLQr4zFXhyNuzhF7ul/qWMw4dlnZvh45ZCQR4qq4rtW MIkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mZDBo1yQefb081IJmAm2imQZuQ/WPjhUva3qUXXrgCI=; b=r3Wt7fQw5xF0R/2e6qDn1KtzB9jbLVwAxujX0Ifi1CFOlOTWY9RMEfZNT5T7K7mxEx HpGWBSRU3ac2QbxAiqQq0l0QHw32Y9eLE5QiQxOUyA7zPPG+U4XLUIan+fsyuQFdegE7 ibFiQDVmz3csoRgUMGLtLqC1pLh05HGBRf0fVo6xjrtIcRWkxeLYpNkOlkVFj1RQFn4c U8mTw+PueF+u+M38KEMb1hCw0WWqUWQ+bxCC6YPbuwS1GNla0ehpEXw+j6tqfpae7IvU X1PGeYqbHJvybL9sTauf2BjeEOuhVg9Tjill4DGUfDWmkDmlPtI5XPjFJTi3Y3H/11Lw zcVg== X-Gm-Message-State: ALQs6tCidsCOrQisQatxs5HB8FHpmBNNdwIqqhMTf2Z6yYoRT+0IBcU+ w1M+zJ6dLs5SgphbfmivT0rs/Q== X-Received: by 10.80.184.198 with SMTP id l64mr2569540ede.5.1523359039974; Tue, 10 Apr 2018 04:17:19 -0700 (PDT) Received: from node.shutemov.name ([86.57.214.118]) by smtp.gmail.com with ESMTPSA id p5sm1649524edh.7.2018.04.10.04.17.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 04:17:19 -0700 (PDT) Received: by node.shutemov.name (Postfix, from userid 1000) id BAEC6648D520; Tue, 10 Apr 2018 14:16:32 +0300 (+03) Date: Tue, 10 Apr 2018 14:16:32 +0300 From: "Kirill A. Shutemov" To: Naoya Horiguchi Cc: Michal Hocko , Zi Yan , "linux-mm@kvack.org" , Andrew Morton , Vlastimil Babka , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] mm: shmem: enable thp migration (Re: [PATCH v1] mm: consider non-anonymous thp as unmovable page) Message-ID: <20180410111632.xtrxmop7p5v2mopj@node.shutemov.name> References: <20180403083451.GG5501@dhcp22.suse.cz> <20180403105411.hknofkbn6rzs26oz@node.shutemov.name> <20180405085927.GC6312@dhcp22.suse.cz> <20180405122838.6a6b35psizem4tcy@node.shutemov.name> <20180405124830.GJ6312@dhcp22.suse.cz> <20180405134045.7axuun6d7ufobzj4@node.shutemov.name> <20180405150547.GN6312@dhcp22.suse.cz> <20180405155551.wchleyaf4rxooj6m@node.shutemov.name> <20180405160317.GP6312@dhcp22.suse.cz> <20180406030706.GA2434@hori1.linux.bs1.fc.nec.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180406030706.GA2434@hori1.linux.bs1.fc.nec.co.jp> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 06, 2018 at 03:07:11AM +0000, Naoya Horiguchi wrote: > Hi everyone, > > On Thu, Apr 05, 2018 at 06:03:17PM +0200, Michal Hocko wrote: > > On Thu 05-04-18 18:55:51, Kirill A. Shutemov wrote: > > > On Thu, Apr 05, 2018 at 05:05:47PM +0200, Michal Hocko wrote: > > > > On Thu 05-04-18 16:40:45, Kirill A. Shutemov wrote: > > > > > On Thu, Apr 05, 2018 at 02:48:30PM +0200, Michal Hocko wrote: > > > > [...] > > > > > > RIght, I confused the two. What is the proper layer to fix that then? > > > > > > rmap_walk_file? > > > > > > > > > > Maybe something like this? Totally untested. > > > > > > > > This looks way too complex. Why cannot we simply split THP page cache > > > > during migration? > > > > > > This way we unify the codepath for archictures that don't support THP > > > migration and shmem THP. > > > > But why? There shouldn't be really nothing to prevent THP (anon or > > shemem) to be migratable. If we cannot migrate it at once we can always > > split it. So why should we add another thp specific handling all over > > the place? > > If thp migration works fine for shmem, we can keep anon/shmem thp to > be migratable and we don't need any ad-hoc workaround. > So I wrote a patch to enable it. > This patch does not change any shmem specific code, so I think that > it works for file thp (not only shmem,) but I don't test it yet. > > Thanks, > Naoya Horiguchi > ----- > From e31ec037701d1cc76b26226e4b66d8c783d40889 Mon Sep 17 00:00:00 2001 > From: Naoya Horiguchi > Date: Fri, 6 Apr 2018 10:58:35 +0900 > Subject: [PATCH] mm: enable thp migration for shmem thp > > My testing for the latest kernel supporting thp migration showed an > infinite loop in offlining the memory block that is filled with shmem > thps. We can get out of the loop with a signal, but kernel should > return with failure in this case. > > What happens in the loop is that scan_movable_pages() repeats returning > the same pfn without any progress. That's because page migration always > fails for shmem thps. > > In memory offline code, memory blocks containing unmovable pages should > be prevented from being offline targets by has_unmovable_pages() inside > start_isolate_page_range(). So it's possible to change migratability > for non-anonymous thps to avoid the issue, but it introduces more complex > and thp-specific handling in migration code, so it might not good. > > So this patch is suggesting to fix the issue by enabling thp migration > for shmem thp. Both of anon/shmem thp are migratable so we don't need > precheck about the type of thps. > > Fixes: commit 72b39cfc4d75 ("mm, memory_hotplug: do not fail offlining too early") > Signed-off-by: Naoya Horiguchi > Cc: stable@vger.kernel.org # v4.15+ This looks sane to me. Acked-by: Kirill A. Shutemov As, yeah, as you mentioned down the thread it's not a stable material -- Kirill A. Shutemov