Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3229189imu; Sat, 24 Nov 2018 00:36:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/VpPJQ+Y6lTQybQ6HbZMttL8ahI+4RpVifPXw2yiZnfuLAXSX5TLT7xEz5LIqS72M7OWS8y X-Received: by 2002:a17:902:20e9:: with SMTP id v38mr17063817plg.250.1543048578990; Sat, 24 Nov 2018 00:36:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543048578; cv=none; d=google.com; s=arc-20160816; b=0TpSCSVowp6H5y954vUSBd+Q9iTgltC2itsQ6fpgewbwb1g1iJ3N3Ky6vSwLrBRKnF pVxuNN9anSuYQNWtq5Ku5Mnteff8VY6X9WeCSVrYA3c15y5sLf+1e7sWUwvXucYCGu+h aE6yR+JcmwWXTXfXzDWW5aBG7oGIOi6/XtjVdYLeUnKaRb1VqIulc8f16YtNQ65JFto3 DZ7w9oEep1z5MiKX4Y+2Pshw52mIfSdxdpginkTFGj/SyK7APfT1AMcSdjAU9MrFD3C7 1yth/F3faFRtSSBz8bonLib95VbZz/V/aAIC6w5f2QmHA3rpzSJUI+FoJ5jz2+NJiUGJ YpYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=TMnWpZ9L/4oXbdtg0MtGjaIfzWnNtJdzePd64qtEKic=; b=UzC4Z7Bh3JrOMDXl74TMU8JGhuHnOtodUUfhERkR1hRvSm5LdA/y0F370mBxqlR1ph s7RYVQzfeW3J8sqTUZSKdwpK8GMhL/0iGVTlLV5bZmq+Df2E0j6QwaW0xvaJhRufkbwE RrOfVoAezWRmWCEtehlODiS/4Y/fTiL0gyzym1j88+8Nwt0/8BTRzC6+KbSFiIwUPB5c SheZnMnvHCBcYWk2IWwVqA3eXezZZUBANATNzVZJYq40UmnU12zDF3GbxmtsSc1ClDtQ AdRQ6usAt9v3YqUTaTvgVxSqJIrpGeEyN0oV6UVUnZ8jjas1Nfj13qrwRt1+lP6cUcdb sNDQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e35si25855824pgb.548.2018.11.24.00.36.04; Sat, 24 Nov 2018 00:36:18 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439834AbeKXAb0 (ORCPT + 99 others); Fri, 23 Nov 2018 19:31:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:45160 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390880AbeKXAb0 (ORCPT ); Fri, 23 Nov 2018 19:31:26 -0500 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 E3C44AF93; Fri, 23 Nov 2018 13:47:07 +0000 (UTC) Subject: Re: [RFC PATCH 1/3] mm, proc: be more verbose about unstable VMA flags in /proc//smaps To: Michal Hocko , linux-api@vger.kernel.org Cc: Andrew Morton , Alexey Dobriyan , linux-mm@kvack.org, LKML , Michal Hocko , Jan Kara , Dan Williams , David Rientjes References: <20181120103515.25280-1-mhocko@kernel.org> <20181120103515.25280-2-mhocko@kernel.org> From: Vlastimil Babka Openpgp: preference=signencrypt Autocrypt: addr=vbabka@suse.cz; prefer-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7k+Sg5ECNXEsamW9AiWGCaKWNDdHre3Lf4xl+RJWxghOVW RiUdpLA/a3yDvJNVr6rxkDHQ1P24ZZz/VKDyP+6g8aty2aWEU0YFNjI+rqYZb2OppDx6fdma YnLDcIfDFnkVlDmpznnGCyEqLLyMS3GH52AH13zMT9L9QYgT303+r6QQpKBIxAwn8Jg8dAlV OLhgeHXKr+pOQdFf6iu2sXlUR4MkO/5KWM1K0jFR2ug8Pb3aKOhowVMBT64G0TXhQ/kX4tZ2 ZF0QZLUCHU3Cigvbu4AWWVMNDEOGD/4sn9OoHxm6J04jLUHFUpFKDcjab4NRNWoHLsuLGjve Gdbr2RKO2oJ5qZj81K7os0/5vTAA4qHDP2EETAQcunTn6aPlkUnJ8aw6I1Rwyg7/XsU7gQHF IM/cUMuWWm7OUUPtJeR8loxZiZciU7SMvN1/B9ycPMFs/A6EEzyG+2zKryWry8k7G/pcPrFx O2PkDPy3YmN1RfpIX2HEmnCEFTTCsKgYORangFu/qOcXvM83N+2viXxG4mjLAMiIml1o2lKV cqmP8roqufIAj+Ohhzs= Message-ID: <28689fcd-fd57-6a1a-6ae1-a860c77842f8@suse.cz> Date: Fri, 23 Nov 2018 14:47:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181120103515.25280-2-mhocko@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/20/18 11: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 Agreed, although no amount of docs will override the do-not-break-userspace rule I'm afraid :) Acked-by: Vlastimil Babka On top of typos reported by Mike: > --- > 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 ^ interpretation > +might change in future as well. So each consumnent of these flags have to > +follow each specific kernel version for the exact semantic. > > This file is only present if the CONFIG_MMU kernel configuration option is > enabled. >