Received: by 10.213.65.68 with SMTP id h4csp3410384imn; Tue, 3 Apr 2018 04:35:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/A1weW1yJzosw7dSxT+I8uMXiJ04Ld5XptptJsLro0SX7io4uFBjShfTiPPSjdEUji6NkQ X-Received: by 2002:a17:902:d20f:: with SMTP id t15-v6mr9058320ply.263.1522755309507; Tue, 03 Apr 2018 04:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522755309; cv=none; d=google.com; s=arc-20160816; b=MYOL6qx8XMMGSAca73K/AiCew11S/12UgVFOK+Q+K2pnoXmTFyc8Fm9p2rpc4Hykv3 U9Eq4kgUD5wHlQUw+agNdmtQoSICJVPwzY+TVHL3olJHbPXY0OZB9RSnhll/5pkDoC+d MvmED5ffmDrhKTAL4Yo3WNcaG0OIYI12JV+TixjrIyguRnOh4kWb8Hcem4rdN4TTUtrT WGWs8IL5DIeTWOxskai0OQhKCDAe/7RbGTiQ9o0Bh9mmxLUAS3ZpYeZjFYjUw5eFVpNj L9KI7eOQUKFNraNLANPddfzgy6z09YoUB4/pPyTLRpCbF2CFI5ARuIRFeUz/jsIJoFaG IMyA== 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=DM7Ee0hHDhCNrpA9qIrQV0Yzn7rsa32bWLCl0R+hfh8=; b=04DtO5FNs4Vq1kikbQhGq/uCupQPCV0TYr7b1b6TPIl2rTStkDozmgtuJfDECkP/rh laR69q8Xrkmf7vs0S6j9pAqHBD+bgUoGGUJvWG8e2YFCuSLi+w4Z6PlzGlcqQcQCuxl0 WDgEF6fp/ha7gX5dUmbwrRyJvlOSAPGNe+1T2TNvG3qQCzkLCA2YIJVc6FxjQ1WExNT3 hKs+NPAMok8f37wmMYCSrQV0TYIfMyQqf8ixx12UQHlDdtoK67yRCK4mehWgZsW3Od4l 8egPgy4ysGpqDBFFyYkvVbK3MwPxNXg+3cMH3A+7jR/L6FSSrTJR0XglN8YzMwYSUNga hLqg== 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 t10si1781684pgv.79.2018.04.03.04.34.55; Tue, 03 Apr 2018 04:35:09 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755343AbeDCLdq (ORCPT + 99 others); Tue, 3 Apr 2018 07:33:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:57123 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755135AbeDCLdp (ORCPT ); Tue, 3 Apr 2018 07:33:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CA4EBAEF8; Tue, 3 Apr 2018 11:33:43 +0000 (UTC) Date: Tue, 3 Apr 2018 13:33:43 +0200 From: Michal Hocko To: "Kirill A. Shutemov" Cc: Naoya Horiguchi , "linux-mm@kvack.org" , Andrew Morton , Vlastimil Babka , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v1] mm: consider non-anonymous thp as unmovable page Message-ID: <20180403113343.GQ5501@dhcp22.suse.cz> References: <1522730788-24530-1-git-send-email-n-horiguchi@ah.jp.nec.com> <20180403075928.GC5501@dhcp22.suse.cz> <20180403082405.GA23809@hori1.linux.bs1.fc.nec.co.jp> <20180403083451.GG5501@dhcp22.suse.cz> <20180403105411.hknofkbn6rzs26oz@node.shutemov.name> <20180403105815.GL5501@dhcp22.suse.cz> <20180403111618.o2w44gtcfzvu3yjv@node.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180403111618.o2w44gtcfzvu3yjv@node.shutemov.name> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 03-04-18 14:16:18, Kirill A. Shutemov wrote: > On Tue, Apr 03, 2018 at 12:58:15PM +0200, Michal Hocko wrote: > > On Tue 03-04-18 13:54:11, Kirill A. Shutemov wrote: > > > On Tue, Apr 03, 2018 at 10:34:51AM +0200, Michal Hocko wrote: > > > > On Tue 03-04-18 08:24:06, Naoya Horiguchi wrote: > > > > > On Tue, Apr 03, 2018 at 09:59:28AM +0200, Michal Hocko wrote: > > > > > > On Tue 03-04-18 13:46:28, Naoya Horiguchi wrote: > > > > > > > My testing for the latest kernel supporting thp migration found out 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. > > > > > > > > > > > > Why does it fail? Shmem pages should be movable without any issues. > > > > > > > > > > .. because try_to_unmap_one() explicitly skips unmapping for migration. > > > > > > > > > > #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION > > > > > /* PMD-mapped THP migration entry */ > > > > > if (!pvmw.pte && (flags & TTU_MIGRATION)) { > > > > > VM_BUG_ON_PAGE(PageHuge(page) || !PageTransCompound(page), page); > > > > > > > > > > if (!PageAnon(page)) > > > > > continue; > > > > > > > > > > set_pmd_migration_entry(&pvmw, page); > > > > > continue; > > > > > } > > > > > #endif > > > > > > > > > > When I implemented this code, I felt hard to work on both of anon thp > > > > > and shmem thp at one time, so I separated the proposal into smaller steps. > > > > > Shmem uses pagecache so we need some non-trivial effort (including testing) > > > > > to extend thp migration for shmem. But I think it's a reasonable next step. > > > > > > > > OK, I see. I have forgot about this part. Please be explicit about that > > > > in the changelog. Also the proper fix is to not use movable zone for > > > > shmem page THP rather than hack around it in the hotplug specific code > > > > IMHO. > > > > > > No. We should just split the page before running > > > try_to_unmap(TTU_MIGRATION) on the page. > > > > If splitting is a preffered way then I do not have any objection. We > > just cannot keep unmovable objects in the zone movable. > > We had anon-thp in movable zone for ages, long before THP migration was > implemented. Yeah, and it was a bug and kind of less serious before we made zone movable kinda more serious. CMA wants to use it for its allocations and the memory hotplug really depends on migrateability these days. -- Michal Hocko SUSE Labs