From patchwork Tue Dec 11 14:36:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 10723913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 354091869 for ; Tue, 11 Dec 2018 14:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2426F29B27 for ; Tue, 11 Dec 2018 14:36:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 184A62A04F; Tue, 11 Dec 2018 14:36:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9207329B27 for ; Tue, 11 Dec 2018 14:36:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 924178E009A; Tue, 11 Dec 2018 09:36:52 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 830708E0095; Tue, 11 Dec 2018 09:36:52 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D1108E009A; Tue, 11 Dec 2018 09:36:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 167C08E0095 for ; Tue, 11 Dec 2018 09:36:52 -0500 (EST) Received: by mail-ed1-f69.google.com with SMTP id l45so7059087edb.1 for ; Tue, 11 Dec 2018 06:36:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SxgSQ41vevm4qZepZDpPxwHugsA+vDQMi7Sz6pwcLHk=; b=JOpGlGjO42souMMD3/J6pTvCtiiLjOcKnUAfva0I5VNPc1rrRm0HMBXjanqoDn/cbZ XRC50Q1m0hWppYi3OXd82BIFFM1psqa8D5ygMyuHDHRQi7a6nzb5zNSzmDECA52/VlYM WaxKrHQYKVBhoxtZuqZYHuK22ikJa0z2dqDqMiJrBNGv0nqpiDEi41WOAav56VGtcFYI 5cs2LEPuIPTZcf9P/QRn/iHGayN4StOtOghBsJ+HjCAdOrwpMAYWjjKS/crjEN4wh6dm upoJpiV8InQB3xQ5EYvjMfD89Pw1Yn8Vu0LsSoXviwxGY/f/42IPM4/HOS1JdJeZvate dLcQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Gm-Message-State: AA+aEWaCuCfWytj3h5SIbqKsWepYedVgtmQxO01hDTQft6asfKaTBRCL c8YVhEQx0OIR7D4VSZJLf/5d9UgdDWUEwIkgjFWmJ/T+1xMiOVDjaJ+S3zaeF4HuhGCeRszsTtl guQzAx+iQggbFqjHEw8hYpqiRSBhkcb6T4zQVZkYuYexpyPmByvIH8wJKLFKZo34WlFcFDMBKjF yAo/5rwXvgggtFqR/0RdzzMDAtUP/ECyRt7LkAXUlyB2sgTqF6WcPtp8WvgzloPfOissa9lFGEy 1Jrcfa80MD/UYUHlov0QSLHRD2mapYqoax3ainGwAyR37KZeGqAyHH+cgLEyKHeZAPVIHEcFyiH yyMV6xR3Z0/9H+n0iBysO3ySWg1PmLDtaFDXmmvlYzWOl2CinlEM84qQT07hGx6jc5Livnv0aw= = X-Received: by 2002:a17:906:3ce9:: with SMTP id d9-v6mr12948878ejh.236.1544539011555; Tue, 11 Dec 2018 06:36:51 -0800 (PST) X-Received: by 2002:a17:906:3ce9:: with SMTP id d9-v6mr12948838ejh.236.1544539010416; Tue, 11 Dec 2018 06:36:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544539010; cv=none; d=google.com; s=arc-20160816; b=qDjlgSxjPrBtRpxuDPUKOqLzvbqDzWMSc+koWct1XLQsFScqcCKWqIrfUgJIQAgcmf uP+uTLL/43HiigrXyJy+QyeOrg3OMGw1RG5NxVlq75UFKZrUwBkky9DHMYtF+KcmrAv4 YPXCpMfaeWiwsniEovulFffInIHpevGDfDtXJFULOay1zIw2vKuxK8XJQlG+3qi6izuO Mwa/9NS0wyrKEnQ75wmvY0xjElI6I7w9CHjGMuJ7L2DHlI7TfqADWKT6+xQtUmGGTM0A V3Mirm2oaVxPFpoSZn0Dv7XlqlLOz5ruIFpcY/fX8N46TFHTFg0URwr2bsLRf8xQ3fpO bhdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=SxgSQ41vevm4qZepZDpPxwHugsA+vDQMi7Sz6pwcLHk=; b=XujKCkLDMD2xbgswvJbf2mp3Cc3KelqtzhKqhKAd4T22aiu9S0ZkSdFlgrYM9GlB1I zPXm6kwSduRxBF3hHN/VGj+SG9YsaCrioAxuvxamFhTUeifkRbnq3AgpIFtiDS31LVhR rcdpigfpqO2ImtWHLJVbcDyxNvSB9W3R3gv+InmPtKoNPZvENV3e+jmHzPmBUPDndf3Y o0OHJYLGe04aVrgiaBG4/rgGf16tePisfDDUV9WatCstq1jLgBudo7UooMpYYAahURG7 j3C8QyGaWDhLGWXl1x6ZGvsbDzbo8fMSyS57spWG2ooTiq6O0zg6iYRT33sIg8hFtFFT tVZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w9-v6sor4046946ejb.36.2018.12.11.06.36.50 for (Google Transport Security); Tue, 11 Dec 2018 06:36:50 -0800 (PST) Received-SPF: pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Google-Smtp-Source: AFSGD/UXuasc79hjCYZNspt5DG9q6e3pITQ4jJGUN6Ma0PV9YCqzlzLjEoj1c/VpHKI6ndPYtPTHqA== X-Received: by 2002:a17:906:5c9:: with SMTP id t9-v6mr12876002ejt.111.1544539010079; Tue, 11 Dec 2018 06:36:50 -0800 (PST) Received: from tiehlicka.suse.cz (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id z40sm4017084edz.86.2018.12.11.06.36.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 06:36:49 -0800 (PST) From: Michal Hocko To: Andrew Morton Cc: linux-api@vger.kernel.org, , LKML , Michal Hocko , Dan Williams , David Rientjes , Jan Kara , Mike Rapoport , Vlastimil Babka Subject: [PATCH 1/3] mm, proc: be more verbose about unstable VMA flags in /proc//smaps Date: Tue, 11 Dec 2018 15:36:39 +0100 Message-Id: <20181211143641.3503-2-mhocko@kernel.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181211143641.3503-1-mhocko@kernel.org> References: <20181211143641.3503-1-mhocko@kernel.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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: Dan Williams Cc: David Rientjes Acked-by: Jan Kara Acked-by: Dan Williams Acked-by: David Rientjes Acked-by: Mike Rapoport Acked-by: Vlastimil Babka 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..2a4e63f5122c 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. Interpretation of their meaning +might change in future as well. So each consumer of these flags has to +follow each specific kernel version for the exact semantic. This file is only present if the CONFIG_MMU kernel configuration option is enabled.