Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp567494imm; Wed, 3 Oct 2018 22:59:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Qj7E2mFUXnYD5bHBQYoja1jampXRZ+er5v6yUe3KiGpDYyYYEq0vR18F+2ALYl4vXHhRo X-Received: by 2002:a17:902:2:: with SMTP id 2-v6mr5081897pla.178.1538632754876; Wed, 03 Oct 2018 22:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538632754; cv=none; d=google.com; s=arc-20160816; b=P5yXRyplGkDujmGOu+fAUT1e+pgASD7v4EAu72P5H4Ae9ENV7cxDEy5dtuo+PzG5NJ dmFJAwzKkvFmncHLqof07rTlczPiCyR6P2gISVuyGuCjrGq9ymn/iiKxeRvOc/UlJF05 BBIkppGp65B8FShXvknxQKZDSbaVqzPP7qvbHxnEkKRNCS1nn0GhCz4Jw89my3hPVoIa KXaiBM5gJyciWzfjqaySmEc7uJgmgUN1Kb73c9kDBBg9PCTWLnBH6qJofdNJn0djCnhl zTkjl9PuQ1zrAIyMoHOBTZGTqrazLvzjiHxD0v+Fjl3JU62zgO7ZCG2y+HsJ5d3T/XRJ AJGQ== 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; bh=IjsIAK/pqco/rSibwVjhrM9Dv5PElTlsB/kLIRznYLo=; b=hHyunx/mtK16xJ8hPtck7rui8y4mzdkt1tOkhdBgeLNFzjpzDi71zsNe7yssjqFCBq Yd+QZrj7SuFvRW5uTPNmyB1bJ76DDRrYGmBcEIJ9acFVQe2dddv4sosL7gv4nP5s0d8G bO740TrrUXSmsVZeddlgK4/JveWiBkA74F44J0H7vLRhtYhwlhtweklxM++y9fS/Bdno nv+ZymWa84foGSemhqTd4ZyWIZG6vuMa6i4sycxTICGkU/oziZ61gpO5/JLE5gatE92d j0QeCqkzAec9qAst0+EC1VJkggEY9AVaFvnuiTg2M6cHNcKmbY9EFtqajuUSxj96gExS AXOQ== 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 m10-v6si3646584pgc.130.2018.10.03.22.58.58; Wed, 03 Oct 2018 22:59:14 -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 S1727253AbeJDMuV (ORCPT + 99 others); Thu, 4 Oct 2018 08:50:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:54146 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726858AbeJDMuV (ORCPT ); Thu, 4 Oct 2018 08:50:21 -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 5BC1FACE7; Thu, 4 Oct 2018 05:58:43 +0000 (UTC) Date: Thu, 4 Oct 2018 07:58:42 +0200 From: Michal Hocko To: David Rientjes Cc: Andrew Morton , Vlastimil Babka , Alexey Dobriyan , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org Subject: Re: [RFC PATCH] mm, proc: report PR_SET_THP_DISABLE in proc Message-ID: <20181004055842.GA22173@dhcp22.suse.cz> References: <0aa3eb55-82c0-eba3-b12c-2ba22e052a8e@suse.cz> <20180925202959.GY18685@dhcp22.suse.cz> <20180925150406.872aab9f4f945193e5915d69@linux-foundation.org> <20180926060624.GA18685@dhcp22.suse.cz> <20181002112851.GP18290@dhcp22.suse.cz> <20181003073640.GF18290@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Wed 03-10-18 15:51:05, David Rientjes wrote: > On Wed, 3 Oct 2018, Michal Hocko wrote: > > > > > So how about this? (not tested yet but it should be pretty > > > > straightforward) > > > > > > Umm, prctl(PR_GET_THP_DISABLE)? > > > > /me confused. I thought you want to query for the flag on a > > _different_ process. > > Why would we want to check three locations (system wide setting, prctl > setting, madvise setting) to determine if a heap can be backed by thp? Because we simply have 3 different ways to control THP? Is this a real problem? > If the nh flag being exported to VmFlag is to be extended beyond what my > patch did, I suggest (1) it does it for the system wide setting as well > and/or (2) calling a helper function to determine if the vma could be > backed by thp in the first place regardless of any setting to determine if > nh/hg is important. > > The last thing I suggest is done is adding a third place to check. But conflating the three ways into a single exported symbol (be it nh or something else) just makes the api more confusing longterm. I am pretty sure we have made that mistake in the past already. What if somebody really wants to check for PR_SET_THP_DISABLE? There is currently no way to do that on a remote process right now AFAICS. So it makes sense to export the state in general. Any exported API should be about consistency. If you want to combine all three checks then just do that in the userspace or in a library function. -- Michal Hocko SUSE Labs