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=-7.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,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 2FF6FC55178 for ; Tue, 27 Oct 2020 18:56:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 70098207E8 for ; Tue, 27 Oct 2020 18:56:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70098207E8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E1FAB6B005C; Tue, 27 Oct 2020 14:56:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA7196B005D; Tue, 27 Oct 2020 14:56:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C95D56B0062; Tue, 27 Oct 2020 14:56:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 98AC76B005C for ; Tue, 27 Oct 2020 14:56:44 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3C010180AD802 for ; Tue, 27 Oct 2020 18:56:44 +0000 (UTC) X-FDA: 77418611928.15.coast54_0e021d72727e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id EE2EF1814B0C7 for ; Tue, 27 Oct 2020 18:56:43 +0000 (UTC) X-HE-Tag: coast54_0e021d72727e X-Filterd-Recvd-Size: 3148 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Tue, 27 Oct 2020 18:56:43 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 38B39AC8B; Tue, 27 Oct 2020 18:56:42 +0000 (UTC) Subject: Re: [PATCH] proc.5: Document inaccurate RSS due to SPLIT_RSS_COUNTING To: Michal Hocko , Jann Horn Cc: Michael Kerrisk-manpages , linux-man , Linux-MM , Mark Mossberg References: <20201012114940.1317510-1-jannh@google.com> <20201012150738.GF29725@dhcp22.suse.cz> <20201012153313.GI29725@dhcp22.suse.cz> From: Vlastimil Babka Message-ID: Date: Tue, 27 Oct 2020 19:56:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.3 MIME-Version: 1.0 In-Reply-To: <20201012153313.GI29725@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 10/12/20 5:33 PM, Michal Hocko wrote: > On Mon 12-10-20 17:20:08, Jann Horn wrote: >> On Mon, Oct 12, 2020 at 5:07 PM Michal Hocko wrote: >> > On Mon 12-10-20 13:49:40, Jann Horn wrote: >> > > Since 34e55232e59f7b19050267a05ff1226e5cd122a5 (introduced back in >> > > v2.6.34), Linux uses per-thread RSS counters to reduce cache contention on >> > > the per-mm counters. With a 4K page size, that means that you can end up >> > > with the counters off by up to 252KiB per thread. >> > >> > Do we actually have any strong case to keep this exception to the >> > accounting? >> >> I have no clue. The concept of "concurrently modified cache lines are >> bad" seemed vaguely reasonable to me... but I have no idea how much >> impact this actually has on massively multithreaded processes. > > I do remember some discussion when imprecision turned out to be a real > problem (Android?). > > Anyway, I have to say that 34e55232e59f ("mm: avoid false sharing of > mm_counter") sounds quite dubious to me and it begs for re-evaluation. Agreed. - false sharing? no, false sharing is when unrelated things share a cache line, this is a real sharing of a counter, AFAICS. If the problem is really exacerbated by false sharing of the counter with something else, then the fix is to move the counter or something else to a different cache line. - the evaluation showing of 4.5 cache misses per fault reduced to 4, I think 0.5 cache miss is negligible compared to a page fault - "Anyway, the most contended object is mmap_sem if the number of threads grows." - and surprise surprise, 10 years later this is still true :) > Btw. thanks for trying to document this weird behavior. This is > certainly useful but I am suspecting that dropping it might be even > better. >