Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5686936imm; Tue, 16 Oct 2018 14:28:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV60HzDvFm0nzlIlT/KRtgInB1ZQ8W9HiFsFiJV9SycmLnNHNtqvT1oI59gBvcaRqkMsku4CJ X-Received: by 2002:a17:902:562:: with SMTP id 89-v6mr23476160plf.315.1539725284261; Tue, 16 Oct 2018 14:28:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539725284; cv=none; d=google.com; s=arc-20160816; b=F4bXJwOTS3fX5PCdTWBn2WE3EgUkNRIeJjDqe3iYTQtOqSCkEYxJs7mY0+MhrH1lki mLiZATThAr+ZKHTGTHXrLShoZjWMsl0JNvIy+5M7utiq7ZWH3HhqYxdKWPbJlo9VbI6Q Iyk/oU7kPF4GxNz5D1qEaYsoiD3kDrbIwo0G3ufYnaI67k++0YrjW6s4ORDbuW4vjzRR 8R70C8WkZDjrxx8n1YrYdhPKyxKMrrsnHQBEJPrCUHZOG6876IrRmmZ6tWoIjkgwt1+j s+1pCarN5ZUtQ53DI5iBQqCSXIgF/hXFQGv+fWJpnvbjEs6yj3iq28PcZW+vGN8S49CH dCBQ== 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=cEjiXo0pDyslBkZXXs48s40ZK3GrToDaKA+Tbg/ruN8=; b=h+pB4+25KAgEURtl7u8C5v9rn5dlckkkfP+LrLKCdMjgQhoAtlXappeA2wL0s+7v0U rNcqMXzoppy4Fq/kmvmu2gLCJH/nv6DzlGXhQDvpp7hjcsugDzxRVRMUWtQ1Mko3+Z5+ BuNSWhqzAoLNSDHyx6WRcq16wDo+7myFdyEwFbBTRdii4o2RRuP97TXuQkW660Cf94FS L2ETFyJpVY2DFR+2B1lO3L8nJRXTuzEKWYf/yzFWw6ftf/XYSR5S0XNOwSGYy0qQl5Uz 2VPL5yQIsSjH9yy1Xk4zFWRV87fFnjFScVv/KSR3ORFG8j34LQiuSTAs5PTRAbXfCS6O tZoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HCaWk7Ba; 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 h7-v6si15823913pfe.72.2018.10.16.14.27.48; Tue, 16 Oct 2018 14:28:04 -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=HCaWk7Ba; 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 S1727087AbeJQFQk (ORCPT + 99 others); Wed, 17 Oct 2018 01:16:40 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43752 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbeJQFQk (ORCPT ); Wed, 17 Oct 2018 01:16:40 -0400 Received: by mail-pf1-f194.google.com with SMTP id p24-v6so12065153pff.10 for ; Tue, 16 Oct 2018 14:24:22 -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=cEjiXo0pDyslBkZXXs48s40ZK3GrToDaKA+Tbg/ruN8=; b=HCaWk7BalYOPB6o+U/wf2hPu2rPpUEhKcyLftGHAjaYgWjXWZCRJnphgsS/1cCUdrU E7gVJr5IIMVYxEwwqjBETe/urZjBK4A3UmThftRkyIm9fTr3EGOVhgK7wJIqQZ/Tplep sghd7OdpFxk29X/+USiUSbZVpWOpLU12nu5vuKazvHnhTYKwiX15qAZgHzYcCw50zDZ/ UYiOsxvmJM63pSKup6WWc+Hi56V3YOG4zB4vz47TPhSsNLXc/Rp23bsGq6OdejabzfzK NlewKjRaDW50ezGLFs+EcYXnAp2N0WYkwCX5J6wUxK7XWfxsspgooMnqiSeb0pxFSzIb DWMA== 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=cEjiXo0pDyslBkZXXs48s40ZK3GrToDaKA+Tbg/ruN8=; b=rgvCPfiJz4L40z3aowTnoU25lCoU8etjz4V+g09sSwHXqnb1eAR05nS8mOALnzWgkc cDu9JfKUZMhajn17PKK5QMsjzlxxA0+ibFIRpvHA5KSf2GphUMi9iuyCwKvKDAfGUeST HO1V9MYxxzcYjhLhfeibVtdUMGcQEifZieQswusBpJZNlbQM4ippmY9Gyv4jw+8+kHro 3JvV+UlzDEF1xFFOiae1xa/ll9c6qWScqa0WsAF7qDXqFpq/2mTRTpOgXq56bosQyqG9 qxLpUBvLECNqkkOHCexEA5yzSyYQ0b/+0TcBP1Bl0RFSsRFZHH47FQu7bt3vPUxPqeuK DheQ== X-Gm-Message-State: ABuFfohpXNm03sp112UP8oOGEeb7Wc8GiIF1WYAwuXb4/QqaA7p8QRTL J5qHvzTasqCAGZuQbfiJvdr/5w== X-Received: by 2002:a63:ff46:: with SMTP id s6-v6mr21748116pgk.241.1539725061322; Tue, 16 Oct 2018 14:24:21 -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 y1-v6sm20161163pfy.89.2018.10.16.14.24.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Oct 2018 14:24:20 -0700 (PDT) Date: Tue, 16 Oct 2018 14:24:19 -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: <20181016104855.GQ18839@dhcp22.suse.cz> Message-ID: References: <20181003073640.GF18290@dhcp22.suse.cz> <20181004055842.GA22173@dhcp22.suse.cz> <20181004094637.GG22173@dhcp22.suse.cz> <20181009083326.GG8528@dhcp22.suse.cz> <20181015150325.GN18839@dhcp22.suse.cz> <20181016104855.GQ18839@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 Tue, 16 Oct 2018, Michal Hocko wrote: > > I don't understand the point of extending smaps with yet another line. > > Because abusing a vma flag part is just wrong. What are you going to do > when a next bug report states that the flag is set even though no > userspace has set it and that leads to some malfunctioning? Can you rule > that out? Even your abuse of the flag is surprising so why others > wouldn't be? > The flag has taken on the meaning of "thp disabled for this vma", how it is set is not the scope of the flag. If a thp is explicitly disabled from being eligible for thp, whether by madvise, prctl, or any future mechanism, it should use VM_NOHUGEPAGE or show_smap_vma_flags() needs to be modified. I agree with you that this could have been done better if an interface was defined earlier that userspace could have used. PR_SET_THP_DISABLE was merged long after thp had already been merged so this can be a reminder that defining clean, robust, and extensible APIs is important, but I'm afraid we can't go back in time and change how userspace queries information, especially in cases where there was only one way to do it. > > The only way for a different process to determine if a single vma from > > another process is thp disabled is by the "nh" flag, so it is reasonable > > that userspace reads this. My patch fixes that. If smaps is extended > > with another line per your patch, it doesn't change the fact that previous > > binaries are built to check for "nh" so it does not deprecate that. > > ("THP_Enabled" is also ambiguous since it only refers to prctl and not the > > default thp setting or madvise.) > > As I've said there are two things. Exporting PR_SET_THP_DISABLE to > userspace so that a 3rd party process can query it. I've already > explained why that might be useful. If you really insist on having > a per-vma field then let's do it properly now. Are you going to agree on > that? If yes, I am willing to spend my time on that but I am not going > to bother if this will lead to "I want my vma field abuse anyway". I think what you and I want is largely irrelevant :) What's important is that there are userspace implementations that query this today so continuing to support it as the way to determine if a vma has been thp disabled doesn't seem problematic and guarantees that userspace doesn't break.