Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1035800imu; Tue, 20 Nov 2018 10:34:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/W7oM5PxBkyuiZ+zsZX/F3ZOJOPbeTBJc7OEooUlJJHHwVnqHTbmSdrGnVx73mw+1woYIfU X-Received: by 2002:a17:902:7d89:: with SMTP id a9mr3390488plm.242.1542738840352; Tue, 20 Nov 2018 10:34:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542738840; cv=none; d=google.com; s=arc-20160816; b=qE6nhQIB2sfDKfQ0f7fmAhwscV0SLV83SJhPxU6ZIEBfUghtQr6WteYfMVY1aCAsq2 9Fo8TmRRhI7Ss0f+RTppZ0fGrProbs6T7/mmPdLgajXKZELeRv5roQGFPcCqc303paQu WUquQO4L0XcnyPEJnWcIGULr7hXadyEUokpaIXgY98aLM73N9DivBuUDqaeJvnN8v8n0 2rD0vKboGJqVOY+ns7tuNzoIBPAbdHB+4eLUg+HnJhxcpIfF5G7feQmyBYuNVTsCf9Uw +wUmQvRkZxjwXgCJ6+kmRN1HC5+hMs59P4ve43LZtsgtJWL8++m+pcVbkwNm5G9NGq1G w5SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dCS+kDrqH7XNTHACmJZWL2qvQRk0qOfHP6zwP9JHfhs=; b=I0rng6Xwvceb8eWsMsbrE1PEl0+k+zVgbQfEODZ7EzacSHXrUHjDzI2a9p1Ahp224d PQk4Y90GSwFGUEyHM5J79Db2jiB27W2kM/qYyrRz/CeeMZ/r202tT0yjZWRCElZX7IEK nMPJovuSXnu1bXnRxTcufNsyO+heCXocWOzB2nflWy1Wq598Zc18Yid8zCsHJooAtfvW lDq50kj10Q0DztmZhSqykTX9BJlY5wk0zcwBdeDfV1lWrWJAP8nLe5EjdXoZR7zlzmSo K7dQ3aaw6KMoZpPnqYdqdYGC86kgUg9v6JY4g+CqaYvo7fPCc+LwR9ol2e6h0BbMgtMy xBMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b="TRCD+W/e"; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p185si14654791pfg.220.2018.11.20.10.33.39; Tue, 20 Nov 2018 10:34:00 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b="TRCD+W/e"; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726106AbeKUFCv (ORCPT + 99 others); Wed, 21 Nov 2018 00:02:51 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:37708 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbeKUFCu (ORCPT ); Wed, 21 Nov 2018 00:02:50 -0500 Received: by mail-oi1-f194.google.com with SMTP id y23so2345240oia.4 for ; Tue, 20 Nov 2018 10:32:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dCS+kDrqH7XNTHACmJZWL2qvQRk0qOfHP6zwP9JHfhs=; b=TRCD+W/e3YIvnsIQWqmPvIY21u60uAvxCZ2hMgRzHHkpumkwA9ftVsqL2ZLkFwFdXG B3r29+qOMZ+TYm13KDLshsZJ0PUiEmwYK8gwTBL2iJuZvqXd6gBXm8yswgmbwK8Fs8Da ObZVcnP5eqHCgvp5X3DGCPAU/lCmPex4cF5iatWT+v5ie9E8YjmJMOzQ1me1oLuwc2EV p1vUPbIwg106li6e3zLLOa/5KFfeRZpufsRHFIH03zzyKr7I3UB4/aQs3Z/CVhysWutW YmRPRX10JJRNaiKy6RGrGdwgMNO8d92QOi338pessCRAZDdHPc+OavhEbVzTd67tcHdr 4DZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dCS+kDrqH7XNTHACmJZWL2qvQRk0qOfHP6zwP9JHfhs=; b=p1aMqqNTIYq48RjG9Kt6prNJUauhz7n46vu3LeLLgkemdzg9IYb7uCgkfHeYh4Yg3s rEyYo2+G4kCq1BbvEuON/VhY35QJnd0KJwS/HTxSdxDiKPnT8XUGeRW52B0OjwLIXG+e fi/dz7HOK5ls+P/1aPphDcIixq1gHGY4QfyggxGOxwAyZzhqM11tLq6TQMfJiiZQ7Tk0 qb2sYZ61D0w3dh5apCD1rR38M4nZvZWw69E1MxQJqM5/E1fkRbZJF9ArWsWHKYoPC5Km h3nvsUb+TPYWose0CfQFuUxXxKRpSQNZ+g5V+qDGgrgHVIfnC1d9ZO+o/tEUxBsMBTV0 8tcQ== X-Gm-Message-State: AGRZ1gKKnJbOPHoNZpW7JJqqmFL09LgCNJD6Jm9gQfm4dVlOnQ7LWHjo TYOzuAxyghMi4ZmQxa+bu7hUp4OLs47d+96z/fvWbA== X-Received: by 2002:aca:f4c2:: with SMTP id s185mr1811409oih.244.1542738738981; Tue, 20 Nov 2018 10:32:18 -0800 (PST) MIME-Version: 1.0 References: <20181120103515.25280-1-mhocko@kernel.org> <20181120103515.25280-2-mhocko@kernel.org> In-Reply-To: <20181120103515.25280-2-mhocko@kernel.org> From: Dan Williams Date: Tue, 20 Nov 2018 10:32:07 -0800 Message-ID: Subject: Re: [RFC PATCH 1/3] mm, proc: be more verbose about unstable VMA flags in /proc//smaps To: Michal Hocko Cc: Linux API , Andrew Morton , adobriyan@gmail.com, Linux MM , Linux Kernel Mailing List , Michal Hocko , Jan Kara , David Rientjes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 2:35 AM Michal Hocko wrote: > > From: Michal Hocko > > Even though vma flags exported via /proc//smaps are explicitly > documented to be not guaranteed for future compatibility the warning > doesn't go far enough because it doesn't mention semantic changes to > those flags. And they are important as well because these flags are > a deep implementation internal to the MM code and the semantic might > change at any time. > > Let's consider two recent examples: > http://lkml.kernel.org/r/20181002100531.GC4135@quack2.suse.cz > : commit e1fb4a086495 "dax: remove VM_MIXEDMAP for fsdax and device dax" has > : removed VM_MIXEDMAP flag from DAX VMAs. Now our testing shows that in the > : mean time certain customer of ours started poking into /proc//smaps > : and looks at VMA flags there and if VM_MIXEDMAP is missing among the VMA > : flags, the application just fails to start complaining that DAX support is > : missing in the kernel. > > http://lkml.kernel.org/r/alpine.DEB.2.21.1809241054050.224429@chino.kir.corp.google.com > : Commit 1860033237d4 ("mm: make PR_SET_THP_DISABLE immediately active") > : introduced a regression in that userspace cannot always determine the set > : of vmas where thp is ineligible. > : Userspace relies on the "nh" flag being emitted as part of /proc/pid/smaps > : to determine if a vma is eligible to be backed by hugepages. > : Previous to this commit, prctl(PR_SET_THP_DISABLE, 1) would cause thp to > : be disabled and emit "nh" as a flag for the corresponding vmas as part of > : /proc/pid/smaps. After the commit, thp is disabled by means of an mm > : flag and "nh" is not emitted. > : This causes smaps parsing libraries to assume a vma is eligible for thp > : and ends up puzzling the user on why its memory is not backed by thp. > > In both cases userspace was relying on a semantic of a specific VMA > flag. The primary reason why that happened is a lack of a proper > internface. While this has been worked on and it will be fixed properly, > it seems that our wording could see some refinement and be more vocal > about semantic aspect of these flags as well. > > Cc: Jan Kara > Cc: Dan Williams > Cc: David Rientjes > Signed-off-by: Michal Hocko > --- > Documentation/filesystems/proc.txt | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt > index 12a5e6e693b6..b1fda309f067 100644 > --- a/Documentation/filesystems/proc.txt > +++ b/Documentation/filesystems/proc.txt > @@ -496,7 +496,9 @@ flags associated with the particular virtual memory area in two letter encoded > > Note that there is no guarantee that every flag and associated mnemonic will > be present in all further kernel releases. Things get changed, the flags may > -be vanished or the reverse -- new added. > +be vanished or the reverse -- new added. Interpretatation of their meaning > +might change in future as well. So each consumnent of these flags have to > +follow each specific kernel version for the exact semantic. Can we start to claw some of this back? Perhaps with a config option to hide the flags to put applications on notice? I recall that when I introduced CONFIG_IO_STRICT_DEVMEM it caused enough regressions that distros did not enable it, but now a few years out I'm finding that it is enabled in more places. In any event, Acked-by: Dan Williams