Received: by 10.213.65.68 with SMTP id h4csp3374726imn; Tue, 3 Apr 2018 03:56:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/YD+dQHySR87roYu+QOWSkaWzrQ0wG2XngWpulxrZP1E9T2F1x57OsraV0HT6IxRs9UArv X-Received: by 10.98.87.151 with SMTP id i23mr10137544pfj.175.1522753015345; Tue, 03 Apr 2018 03:56:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522753015; cv=none; d=google.com; s=arc-20160816; b=DuwP+98/XSWbqx1qdiD51CuWU42madzcAXeTMl7iWAYSnyFnerxZwIqbqjKWOPr/IU +EEatw8LjWKHfGWOZMWcouekZPPZSSd/KNXh59T9LnMXh5v669Wcx+bXchYWLwAhc/xG bJyXnM9N5Y9bwWDi65RCyMPSsllHCZIxRdKhoyjPqf/eUgodoNRJcTFdB73ZdUDDIDvq ktiyuY1GnmETy+GqkVOgtKXqdzG5POJ7S2/sWeMHr30rLVEHqi3wcVMiD5gx84267bfX 3ZEyMb5/tHphPXKCFiKVyafDNxI3eD+w6BQbZ6iQ2aCsI4D/lU57sw48ugiVxO8fLY1U z88A== 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=OWNxIiWRHWU3QzzHJixbnBqlEXDTftXL0NiPdsS8XO4=; b=qTRg4bt94Pg7NLetlGml/U3g/dsUY0ZACy2RH/6or3AlOOoA35S7xXuXJIzrlAmY9i Li5xzZSIsCVn5q8xLcUNneyUnX3k/1dIHbfRCiK/FBfUdNekXf7Kl+i4VTFO66vy/0zU 6m/gYwTEDTixo2+pXBdwiBRLLV+K2uCIuf/p74fKOPh1MQX5QLoD810bK2IquxJrXIA9 JwrcuHmS05R7jomSFkiBRC8/eJKH/hc28uEhgCKxvgWpl/NK7g1v3KGk1SjYZQFCDgFi mSmR8/IC6mxBe26Vhnhpt0L6fXUsgEiczVDRYoJb/k9/rlApmc9+d7/xL+VE1rawVUk+ Iuxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=stLCMcY0; 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 v10-v6si589786plz.268.2018.04.03.03.56.40; Tue, 03 Apr 2018 03:56:55 -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=stLCMcY0; 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 S1755401AbeDCKyy (ORCPT + 99 others); Tue, 3 Apr 2018 06:54:54 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:55551 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755267AbeDCKyx (ORCPT ); Tue, 3 Apr 2018 06:54:53 -0400 Received: by mail-wm0-f50.google.com with SMTP id b127so31990029wmf.5 for ; Tue, 03 Apr 2018 03:54:52 -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=OWNxIiWRHWU3QzzHJixbnBqlEXDTftXL0NiPdsS8XO4=; b=stLCMcY0pGUW7x/qrg2eiIDZNkoRe9l8x6hxntACMamdiZon6+Ms3h7+/oOLBwt1tH IF6hmduNXp6EsFK4KiyPNdvWv7XcwDEwF7YJCOrx2PRjaC3fo+F0WRY6YsLhy0PBLcxA 9jI+WJKHOxry/+5/5KuX4H5MlGjzRO2/DpgamWBYAi/RqazdZubH3rpF9fcvUEEFo2qa UCpLqk2ehVQebRcDzAXh3PG6iutuYP1BR3ry/YXCfEpNWfALZPxw23rAXa5sQCR4TKQQ 750tXpuRgvrtC5y9qCwu9pRHrMypeM/xr4XhEt8T67yd308X7/cpzzC5lCMOddpvgGd4 Fm9g== 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=OWNxIiWRHWU3QzzHJixbnBqlEXDTftXL0NiPdsS8XO4=; b=P4Gt5euCKeUmmNytkvZlPBmcnHGri4D9K4CxoBqbpQsPVJzG03BFtZNNohE8m1StgO QOuW1/jw3l9XcaNsyD8mERqvLnxwAOHI7SCg3Msc09y4R/dFB9QAy0DQMGmD3hG/jbdA kC3C+iZUQeMgDotxaoCuyzHa1eImNv7B/XRPmwUPrsjhR4+wCtpE4aCyKfoPZOPs49OM cKMTuS9vI2QSuNUOhzU9Pg3VjgVSJ/r9MN0Vn18+xhYCS6M0L3lFWOqc/Lwa5tVMCfqC DiQ3bT8WfvYlGxl2DhPVGUEZKf3YPyX4cSFswHiz9SPMi7LU8lKMxXKMWZzdDJxqIsJw HkpQ== X-Gm-Message-State: AElRT7HuAzQ96bZ+WV2NwgAsVlYNZesnK+rQDNz8hcXZzcJ1oD1RBNM+ 7wXoLYaEA9Mn8dRn3ZV0VWbVbA== X-Received: by 10.80.235.65 with SMTP id z1mr16006248edp.154.1522752892083; Tue, 03 Apr 2018 03:54:52 -0700 (PDT) Received: from node.shutemov.name (mm-64-205-122-178.brest.dynamic.pppoe.byfly.by. [178.122.205.64]) by smtp.gmail.com with ESMTPSA id m1sm1782558edd.26.2018.04.03.03.54.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Apr 2018 03:54:51 -0700 (PDT) Received: by node.shutemov.name (Postfix, from userid 1000) id 55CC2648D522; Tue, 3 Apr 2018 13:54:11 +0300 (+03) Date: Tue, 3 Apr 2018 13:54:11 +0300 From: "Kirill A. Shutemov" To: Michal Hocko 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: <20180403105411.hknofkbn6rzs26oz@node.shutemov.name> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180403083451.GG5501@dhcp22.suse.cz> User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Kirill A. Shutemov