Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp298986yba; Wed, 24 Apr 2019 01:07:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxMWSVtr9Olrl7Jv1PC4U9FKErmhDo1Ru7ocFel0u3btbgHSrt04Wtt6sA4yq5YKzRAwLFg X-Received: by 2002:a17:902:8ecc:: with SMTP id x12mr31310552plo.0.1556093257927; Wed, 24 Apr 2019 01:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556093257; cv=none; d=google.com; s=arc-20160816; b=e2RXRQpL8K+yCWtJmeu3xzUwx8EYMKPXnHgXWoyzBStj/YHzj3zpDYreVkrB7j0YCV cChKGydsC0PHHqQ1JiyKNKfQaZ29I6prl+3gCXb33VbHHgSY7MkeRmc8XGp7hU5iR49H o8YAUw6QrkdCy1ZQ09BMx2rRFrv+ajV0eXEPHMbwttlIJnjK5K2caBUhx7Kec152/hXz KrP4zkteLv1PcrGa5wYz2C9/6ANrCjUahR/adtPltQdaDnqegi6v3ixPsliyt/dMs4VJ 0QCuHrp1/cn4n3jBpYrM5Cpzr/NCFNWpIKfW/44cm3Uswl6dAsLywRgy7qM7v0ukEVWf r0HA== 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=vEBcBXf+DqM2twrJw6kDqdh2aZMApzFL8kbj67SqfPk=; b=DByePLjWcDJtrDwTs4NsFvjH2hMrB66WxtPcNShJbIESy4Cv/JCHkPFcBs+tO4h1DK kJwLUv5f950/bEVnT8a7StpuEhVu+77o3l+fkJiawPmzGnkKVNKWqgxZnut8nbAsZf/y SBTFBxTeudz+DJ3Xpmn/TwJ6ydyXgdYyIJgEhltIaopA9e66h1R+j2/lVjgo4y+I9+xC NFBhhe76C1bWnAQKZ5peDZ4m4doLTGO2+zemJNPzQYp0BgBzpFF9s8ieoqHg/wfEVa0v Gcx626ZmVRcp9NJ5a5D+qAk45BzfJZnoLvsfM+RU3EXfCGxLcRrVVTctVpkRjpuhGGoL 80tA== 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 cj7si10337916plb.326.2019.04.24.01.07.20; Wed, 24 Apr 2019 01:07:37 -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 S1728990AbfDXH6i (ORCPT + 99 others); Wed, 24 Apr 2019 03:58:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:56538 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727333AbfDXH6i (ORCPT ); Wed, 24 Apr 2019 03:58:38 -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 25D96AE2B; Wed, 24 Apr 2019 07:58:36 +0000 (UTC) Date: Wed, 24 Apr 2019 09:58:34 +0200 From: Michal Hocko To: Yang Shi Cc: vbabka@suse.cz, rientjes@google.com, kirill@shutemov.name, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH] mm: thp: fix false negative of shmem vma's THP eligibility Message-ID: <20190424075834.GB12751@dhcp22.suse.cz> References: <1556037781-57869-1-git-send-email-yang.shi@linux.alibaba.com> <20190423175252.GP25106@dhcp22.suse.cz> <6004f688-99d8-3f8c-a106-66ee52c1f0ee@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: 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 On Tue 23-04-19 17:22:36, Yang Shi wrote: > > > On 4/23/19 11:34 AM, 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? > > > > > > I have to say that the THP tuning API is one giant mess :/ > > > > > > Btw. this patch also seem to fix khugepaged behavior because it > > > previously > > > ignored both VM_NOHUGEPAGE and MMF_DISABLE_THP. > > Second look shows this is not ignored. hugepage_vma_check() would check this > for both anonymous vma and shmem vma before scanning. It is called before > shmem_huge_enabled(). Right. I have missed the earlier check. The main question remains though. -- Michal Hocko SUSE Labs