From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24A32C2D0C9 for ; Thu, 12 Dec 2019 10:55:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D64382173E for ; Thu, 12 Dec 2019 10:55:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="gukNWPOQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D64382173E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E6016B3710; Thu, 12 Dec 2019 05:55:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 595B76B3711; Thu, 12 Dec 2019 05:55:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45DC96B3712; Thu, 12 Dec 2019 05:55:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id 317CD6B3710 for ; Thu, 12 Dec 2019 05:55:24 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id C3213181AEF15 for ; Thu, 12 Dec 2019 10:55:23 +0000 (UTC) X-FDA: 76256182926.27.hair27_11ef266564955 X-HE-Tag: hair27_11ef266564955 X-Filterd-Recvd-Size: 3837 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Dec 2019 10:55:23 +0000 (UTC) Received: by mail-lj1-f169.google.com with SMTP id h23so1755082ljc.8 for ; Thu, 12 Dec 2019 02:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VAqqRxpg/DY39Y3CIPpMww47SbD53TIFC+ZzmyAQfYY=; b=gukNWPOQeSrrc/Jhlhy1Vb+RYEAGS3nIkF0v3M0MzmMkYKr0Ame1WFG7LOuB3novpo 5WcYswfYLVmdbzgWhWfRiyRfqnaNd/We8dzBA9BmVSgyuRIsB3I/ZZVge+2MZGC35NSg RBOC9ipLFXKhhvrTbGHwHy1JE3w5xbGqDrFLXQK4OnsXmpZhO9xBvP9LOjqNgB5xUch1 mILKYozKDUst3L+kjl0NmWTYZVDPEL92xsJfuQa8DIzI5vXaR3xGB0ZGPydgLOHrToNO 4ku/8aHwYR7cEVSYiYtagVS6CPrxiuW9ipcXCezFqWdYyXuRlM66FB8gWEAU3slSHmnU /3XA== 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:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VAqqRxpg/DY39Y3CIPpMww47SbD53TIFC+ZzmyAQfYY=; b=GuK/Ilxo3R/1ZUB+PTzMHG/driPJPUtgT9OdV9m/E85ibRwoo8ozioIzQW+3but8ze mzu2fwSz9f79ZLeWsVtoaiK82VYm6ZgvTj1u2c4kc27m5SC8HhoXt71q348a3lgaSAaD aor8wKDr89F5MHQrw8Scx2ebCG5j4Q4/yjF3goWHCa4nHWyCRGT06WBlSGXDdX4w8KiZ 08+ffLiPa9/lW+4X1+/T1CFLNioYSKBGOuDc97mXL9GFlSUADiJtA9iJBY5sMVPnU7v2 d3VTi8ygq6hXKs2idjobMhFquDI1k+O6OkGMV6r2EZmGBwlh/ebVkgxMH8MJsyT0Zhw3 Y2kg== X-Gm-Message-State: APjAAAXVYYxAUvzmSMiJIlJ3Hmxk/hQL5q2Rs5IRVlvOo6YLm79VNjrR mzL59wKL2z+aLkHCqvSzNpw99A== X-Google-Smtp-Source: APXvYqzAk0jZTLfzFN8FuRIkyWzebemYnETl0koNxUK0N8buWFCtwDbezlJC1MCK0ED6GQodJG/j8A== X-Received: by 2002:a2e:9f47:: with SMTP id v7mr5258328ljk.124.1576148121599; Thu, 12 Dec 2019 02:55:21 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id z7sm3065200lfa.81.2019.12.12.02.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 02:55:20 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id CDA7B1000BD; Thu, 12 Dec 2019 13:55:21 +0300 (+03) Date: Thu, 12 Dec 2019 13:55:21 +0300 From: "Kirill A. Shutemov" To: Joel Fernandes Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@suse.com, riel@redhat.com, minchan@google.com, hannes@cmpxchg.org, kirill.shutemov@linux.intel.com Subject: Re: rmap for shmem pages Message-ID: <20191212105521.kwqn6hiudt3tbr6g@box> References: <20191211235108.GA85068@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191211235108.GA85068@google.com> User-Agent: NeoMutt/20180716 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: On Wed, Dec 11, 2019 at 06:51:08PM -0500, Joel Fernandes wrote: > Hi, > I am looking into a weird behavior of the VmRSS counter in /proc/pid/status > which I think is a bug. > > The issue is if a memfd is mapped into the same process twice as MAP_SHARED, and > you write to both maps, then the RSS doubles even though the pages were > mapped elsewhere within the same address space before. We expect RSS to > increase only once in this case, not twice. VmRSS is a best effort. Meeting your expectation would require rmap walk (as your patch does). It's way too expensive for fault path (especially under page table lock) just to keep percise statistics. Sorry, but you will not get it. -- Kirill A. Shutemov