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.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 310D3C43603 for ; Thu, 12 Dec 2019 14:43:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E15EA21655 for ; Thu, 12 Dec 2019 14:43:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="V0z1C1TC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E15EA21655 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 70B4F8E0006; Thu, 12 Dec 2019 09:43:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BBC28E0001; Thu, 12 Dec 2019 09:43:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AA6C8E0006; Thu, 12 Dec 2019 09:43:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 418828E0001 for ; Thu, 12 Dec 2019 09:43:17 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id E79F24845 for ; Thu, 12 Dec 2019 14:43:16 +0000 (UTC) X-FDA: 76256757192.22.stamp03_73e851e45044c X-HE-Tag: stamp03_73e851e45044c X-Filterd-Recvd-Size: 3866 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Dec 2019 14:43:16 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id c23so683909plz.4 for ; Thu, 12 Dec 2019 06:43:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ShI0y8D+ovNYT5syG2AcqRT1DG+n57dyIhbrd766+tU=; b=V0z1C1TCU8T+bRVdUrKXiR6dltvEzxpWnqbG2waS8BQ023OuNwDUmgDuHaFLe3LQFJ zwXeFNROJDenhdwGhTwEik+o1a+XRYZhd2sf5gkg0YO+GLqV+4kL/jyHEu1arD6FiYSt AJ3XStsc9brvhk2VqiYyguahdzsl+hoc+APjI= 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=ShI0y8D+ovNYT5syG2AcqRT1DG+n57dyIhbrd766+tU=; b=P4o5eM3qxXurTcOZSDwrOLNurRq0Tfs1sg3jVkFbCyaq62F7t3guCSRfIRHUf9cQO3 bvejYotLMMXrRikibSa6kfnOTfU3pquBe/ZQfLWPPkDaCXFk9ddTS6KVBNzzwov4LAmq E44LS6RtAr+6bD1yLVu48ZsP90fLFVR9x4nW3BTCaDvMcc+cCBH/MYUgY1IId4Ay2lbA FeKyzErfUP5owrfSBUgtx0quG8MKNvbQG70XvU9VsUq2YGsUmK5czzcZAXAhJpWdstcY G8W2D4sdsbtHE5w3Lx5axcUpjw+eUCOQ8WLAQ1B0Q2gy00DFUYnPN/binpGvls9w+CDE qiwA== X-Gm-Message-State: APjAAAWpe9zMSApUujeznpFYKGifv5mhdLDMg1bo6wmCujSPudgpTcyt g7uMOfpXB3rpNGa+wF+PoIyVyw== X-Google-Smtp-Source: APXvYqzjN/hAAmFt+sd1IOg+y7pa4CNWWEqZjEycFKSzGl79WA9ElboKi9kkyAvvtCUqaWhXXmMgSA== X-Received: by 2002:a17:902:8c96:: with SMTP id t22mr9982111plo.288.1576161795208; Thu, 12 Dec 2019 06:43:15 -0800 (PST) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id g191sm7405351pfb.19.2019.12.12.06.43.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 06:43:14 -0800 (PST) Date: Thu, 12 Dec 2019 09:43:13 -0500 From: Joel Fernandes To: "Kirill A. Shutemov" 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: <20191212144313.GC129023@google.com> References: <20191211235108.GA85068@google.com> <20191212105521.kwqn6hiudt3tbr6g@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191212105521.kwqn6hiudt3tbr6g@box> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Thu, Dec 12, 2019 at 01:55:21PM +0300, Kirill A. Shutemov wrote: > 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. No problem. I was under the same impression that this is difficult to do in a scalable way. I am glad I reached out but if anyone has any other ideas, let me know. thanks, - Joel > > -- > Kirill A. Shutemov