Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp729034imm; Thu, 4 Oct 2018 02:17:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV63M8Cmj9MpO5GBkrgTLQLC78GzEwVzDrb43yfX9JQ39xmN/2nRZ+4R3c+aVby6RcdRIXVB2 X-Received: by 2002:a17:902:1121:: with SMTP id d30-v6mr5494737pla.250.1538644657983; Thu, 04 Oct 2018 02:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538644657; cv=none; d=google.com; s=arc-20160816; b=PpviTEcOPwzlHdl0tXCM4evJQfkcD8Tgo/Vgh01XPqAj5G1IRyk8mkug0lp4mBFvkx lRtR5Pt3Zfj6aIfu0ZEE5Xvhqs99Rx9rtYMWxyPlyXiF8RRlFBhYStr+ooZ0owuq/fGR 7Mo2peNMvWD5Zpg555tPmqbfqammiziC9kZkY0UBEkfojeL28PFzJgrvOT+vs4Ja8Tsb Zx0K+G9rdjz1mi6cOlJazOjgQ0utWGu5qKugdQzqhrDxmPWLIrAZZMDH7gbDHrM9ducy 25SOwTagamKSutdrZM3eBYj8tSE8qd+QU1dlYzRtMJUK+yZL+F4ftPFIz1+kY7RHeRgH wPDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=pz+qjDnOSMwpXFoomShA6aeyy9jCwAHreDh5uaYSGw4=; b=o7KomAebp2tcyLdBPJyJoGttPiB8SqXpbGPkKK95+OFyUTLCFNGsZyF6J6QJ9jbSI9 0S6Ejb3Oecv7xo4EjJRRfSFxoI3WIviJVQk2mzG265o4E8VxlWxIG5ZQLGlAYBpcIXJQ 5aRGP8ZSisA2sosFGfKyd+NPPgIsDWDXKzw2wO7f0Or7tSdqbmsv+cM9mj7eiKT0b9c0 ZxgHf0TOO9ZOqzb+J8vQihrkBwWpCyWe4cPXt9mITIebRrn+aDUhhKBWO/SVQcdYdqi3 qUALkAhyS99VNYdKP0exVWzPmMKVr1g9PR8Ay/f+tDdD6TwLlySQegoX3weD98/aCF+t qwug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=PalRItz4; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9-v6si4293709plk.153.2018.10.04.02.17.22; Thu, 04 Oct 2018 02:17: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; dkim=pass header.i=@google.com header.s=20161025 header.b=PalRItz4; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727604AbeJDQIA (ORCPT + 99 others); Thu, 4 Oct 2018 12:08:00 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41669 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727030AbeJDQIA (ORCPT ); Thu, 4 Oct 2018 12:08:00 -0400 Received: by mail-pf1-f194.google.com with SMTP id m77-v6so3069911pfi.8 for ; Thu, 04 Oct 2018 02:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=pz+qjDnOSMwpXFoomShA6aeyy9jCwAHreDh5uaYSGw4=; b=PalRItz4CJbLU9DlF4v7lSa6nTWNoCZup+cePw6Hhe56af4GSN9heIUSyKUnXiJbXP DOTk6ZP7DZ378YlvFRumk6W+8Ejs817zhv2kzT6yNYbsZypespznRXwbb2mShxQQAVEJ bZ5GdeM1VW2B7qMp4SnpzwQUWKk7qJZmAFsVuqr7X52x253TVj/ntM4PEO9DBR4BoN5l O2rNLCpFHtflvQQGTuXMW/FdemPcZI1uEncCfVDyo2XHWccXufa+GiFSwV2LLUOFkhv3 8wvlpWuLrbHY+6RiiwG2gLCj3AWb+ICTPYdumaibrkgI8hivru+1XTUJiz6Cts+MGbEj Vf9g== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=pz+qjDnOSMwpXFoomShA6aeyy9jCwAHreDh5uaYSGw4=; b=jShUnnwUACol7uw+cfN3LzJaF2oJMMp4u9kgw6kG8gROZk7J7TXJkuVuMFzW7B6Q4m 9FJw/VXtCMSu0o0iXBOcbOtIfzUxgIS0OdApOcIpfyGuuCRWMprEdDOYHGX5Lt66KQzI qDpwt5csPJjDwwhyLn++6MRB6vLpTBDnkKoYPHhW1eR4/OQkvcXASKvZmTBLQpPz8Fkv 5hxPwxoCUuLCVEB2/cNu4ZymKvRO9arvIWGsiVF77oTlX7yEaYCQdBczViHhpjbuB6ii JTWjXvCTpMeKk1gU5eMNlZXti6J6ZKomWc095C8ipreMcTLRQrL5Kn6mO3/LS/DDE6mc NWSw== X-Gm-Message-State: ABuFfohRC/BwmaurvsGOpeHiPTIy4fckr7+D/IkPD/+YZKZn4BSrSSzJ BINzT5F9Y8Ux4VqJoLbpV1hCSQ== X-Received: by 2002:a62:401:: with SMTP id 1-v6mr5781763pfe.236.1538644539653; Thu, 04 Oct 2018 02:15:39 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id g5-v6sm6838979pfk.160.2018.10.04.02.15.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Oct 2018 02:15:38 -0700 (PDT) Date: Thu, 4 Oct 2018 02:15:38 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Michal Hocko 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 In-Reply-To: <20181004055842.GA22173@dhcp22.suse.cz> Message-ID: 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> <20181004055842.GA22173@dhcp22.suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 4 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? > And prior to the offending commit, there were three ways to control thp but two ways to determine if a mapping was eligible for thp based on the implementation detail of one of those ways. If there are three ways to control thp, userspace is still in the dark wrt which takes precedence over the other: we have PR_SET_THP_DISABLE but globally sysfs has it set to "always", or we have MADV_HUGEPAGE set per smaps but PR_SET_THP_DISABLE shown in /proc/pid/status, etc. Which one is the ultimate authority? There's one way to specify it: in a single per-mapping location that reveals whether that mapping is eligible for thp or not. So I think it would be a very sane extension so that smaps reveals if a mapping can be backed by hugepages or not depending on the helper function thp uses itself to determine if it can fault hugepages. I don't think we should have three locations to check and then try to resolve which one takes precedence over the other for each userspace implementation (and perhaps how the kernel implementation evolves).