Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3582826yba; Tue, 7 May 2019 03:48:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8h0OfgmMV4Dfp7kGmBpbr6iTk/OA5TyvGsCHkipcK1LyBOEGQ6hUEcn4dZBmH4uLJdohX X-Received: by 2002:a17:902:20e2:: with SMTP id v31mr35505875plg.138.1557226104655; Tue, 07 May 2019 03:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557226104; cv=none; d=google.com; s=arc-20160816; b=wHhcvYIl8DTOT/raEcPuSmUnRl1qEPMfkrLlqL6S9rGOR2ayQhTbGZ3bKhHNqPNAyI 3YyXXNAG0BEi0vFvUDbQh6/h5s18ikN/LPnAFTfEOfRCOW3xPNZ99c63fzjJH1kvo0Of 6DOdvVbD3YkNsrVyZ/jPaeOfMBvktNpCJSf/FIp7Rd4RfF7c3p2zcXZeKmizyDn76Kvx Gqjziu1946I4pVyKghlND+nVpF1bHs/QW2eLa24t1gUifgly01baU30muddaokgx9wcY EpkubQSlkmwM3SQIN+x3KYAbOzv20yabPsFei6amDp9Dm6j4t8xnIV3m8CVCliba2ITq YL1Q== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=exQydsRsuNLlVkrAYWeNATsUHctANXViPZH8mHLZc3Y=; b=t2Vwn0X0bZSLNVkGlUf7/MGwnCcwDe5fsYUSstbJBydwfwhM4F01hlt30siAHjkSxI oWpLmdsVdrpHFRIwrK3D5snRFxirtbQ/cFGcuVFB2+R5cbh1eVjyTtXDjgtYwG/XpM2o /qxUyrVntbCUzgYVSWQHgAUmMgsSptcpd7DGQ1HuIwRJRxPLOm3m8Uq8afzPVXN9eUPf k/4e4fJF8wnPvjW68WtbTBH/2TSTr54DudwTpXd7uoNjx2duus++JGZpXTdtK1ih2hjf BXeToH49VZu0XYSMwfv3LqwaU1kTF2fHyDGu7US9PJE2y7QZd1Cz9USjvAC7jsC3HIdO Guww== 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 r14si20870758pgf.45.2019.05.07.03.48.06; Tue, 07 May 2019 03:48:24 -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 S1726497AbfEGKrN (ORCPT + 99 others); Tue, 7 May 2019 06:47:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:37278 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725844AbfEGKrN (ORCPT ); Tue, 7 May 2019 06:47:13 -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 3D211AD56; Tue, 7 May 2019 10:47:11 +0000 (UTC) Date: Tue, 7 May 2019 12:47:09 +0200 From: Michal Hocko To: Yang Shi Cc: "Kirill A. Shutemov" , vbabka@suse.cz, rientjes@google.com, kirill@shutemov.name, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins Subject: Re: [v2 PATCH] mm: thp: fix false negative of shmem vma's THP eligibility Message-ID: <20190507104709.GP31017@dhcp22.suse.cz> References: <1556037781-57869-1-git-send-email-yang.shi@linux.alibaba.com> <20190423175252.GP25106@dhcp22.suse.cz> <5a571d64-bfce-aa04-312a-8e3547e0459a@linux.alibaba.com> <859fec1f-4b66-8c2c-98ee-2aee9358a81a@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <859fec1f-4b66-8c2c-98ee-2aee9358a81a@linux.alibaba.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 [Hmm, I thought, Hugh was CCed] On Mon 06-05-19 16:37:42, Yang Shi wrote: > > > On 4/28/19 12:13 PM, Yang Shi wrote: > > > > > > On 4/23/19 10:52 AM, Michal Hocko wrote: > > > On Wed 24-04-19 00:43:01, Yang Shi wrote: > > > > The commit 7635d9cbe832 ("mm, thp, proc: report THP eligibility > > > > for each > > > > vma") introduced THPeligible bit for processes' smaps. But, when > > > > checking > > > > the eligibility for shmem vma, __transparent_hugepage_enabled() is > > > > called to override the result from shmem_huge_enabled().? It may result > > > > in the anonymous vma's THP flag override shmem's.? For example, > > > > running a > > > > simple test which create THP for shmem, but with anonymous THP > > > > disabled, > > > > when reading the process's smaps, it may show: > > > > > > > > 7fc92ec00000-7fc92f000000 rw-s 00000000 00:14 27764 /dev/shm/test > > > > Size:?????????????? 4096 kB > > > > ... > > > > [snip] > > > > ... > > > > ShmemPmdMapped:???? 4096 kB > > > > ... > > > > [snip] > > > > ... > > > > THPeligible:??? 0 > > > > > > > > And, /proc/meminfo does show THP allocated and PMD mapped too: > > > > > > > > ShmemHugePages:???? 4096 kB > > > > ShmemPmdMapped:???? 4096 kB > > > > > > > > This doesn't make too much sense.? The anonymous THP flag should not > > > > intervene shmem THP.? Calling shmem_huge_enabled() with checking > > > > MMF_DISABLE_THP sounds good enough.? And, we could skip stack and > > > > dax vma check since we already checked if the vma is shmem already. > > > Kirill, can we get a confirmation that this is really intended behavior > > > rather than an omission please? Is this documented? What is a global > > > knob to simply disable THP system wise? > > > > Hi Kirill, > > > > Ping. Any comment? > > Talked with Kirill at LSFMM, it sounds this is kind of intended behavior > according to him. But, we all agree it looks inconsistent. > > So, we may have two options: > ??? - Just fix the false negative issue as what the patch does > ??? - Change the behavior to make it more consistent > > I'm not sure whether anyone relies on the behavior explicitly or implicitly > or not. Well, I would be certainly more happy with a more consistent behavior. Talked to Hugh at LSFMM about this and he finds treating shmem objects separately from the anonymous memory. And that is already the case partially when each mount point might have its own setup. So the primary question is whether we need a one global knob to controll all THP allocations. One argument to have that is that it might be helpful to for an admin to simply disable source of THP at a single place rather than crawling over all shmem mount points and remount them. Especially in environments where shmem points are mounted in a container by a non-root. Why would somebody wanted something like that? One example would be to temporarily workaround high order allocations issues which we have seen non trivial amount of in the past and we are likely not at the end of the tunel. That being said I would be in favor of treating the global sysfs knob to be global for all THP allocations. I will not push back on that if there is a general consensus that shmem and fs in general are a different class of objects and a single global control is not desirable for whatever reasons. Kirill, Hugh othe folks? -- Michal Hocko SUSE Labs