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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,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 E934FC433E0 for ; Tue, 16 Mar 2021 11:02:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 685AD65026 for ; Tue, 16 Mar 2021 11:02:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 685AD65026 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 E4A016B006C; Tue, 16 Mar 2021 07:02:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E1FA66B006E; Tue, 16 Mar 2021 07:02:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE8826B0070; Tue, 16 Mar 2021 07:02:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id B11316B006C for ; Tue, 16 Mar 2021 07:02:52 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6450A8249980 for ; Tue, 16 Mar 2021 11:02:52 +0000 (UTC) X-FDA: 77925449784.11.D2D8514 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf19.hostedemail.com (Postfix) with ESMTP id CFDA590009F3 for ; Tue, 16 Mar 2021 11:02:51 +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 62934AE5C; Tue, 16 Mar 2021 11:02:50 +0000 (UTC) Subject: Re: [PATCH v3 0/4] mm/slub: Fix count_partial() problem To: xlpang@linux.alibaba.com, Christoph Lameter , Pekka Enberg , Roman Gushchin , Konstantin Khlebnikov , David Rientjes , Matthew Wilcox , Shu Ming , Andrew Morton , Christoph Lameter Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wen Yang , James Wang , Thomas Gleixner References: <1615303512-35058-1-git-send-email-xlpang@linux.alibaba.com> <793c884a-9d60-baaf-fab8-3e5f4a024124@suse.cz> <1b4f7296-cd26-7177-873b-a35f5504ccfb@linux.alibaba.com> From: Vlastimil Babka Message-ID: Date: Tue, 16 Mar 2021 12:02:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <1b4f7296-cd26-7177-873b-a35f5504ccfb@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: nxewjs8ootnq1zx9fz4bepgdf89hifab X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CFDA590009F3 Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1615892571-958708 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 3/16/21 11:42 AM, Xunlei Pang wrote: > On 3/16/21 2:49 AM, Vlastimil Babka wrote: >> On 3/9/21 4:25 PM, Xunlei Pang wrote: >>> count_partial() can hold n->list_lock spinlock for quite long, which >>> makes much trouble to the system. This series eliminate this problem. >> >> Before I check the details, I have two high-level comments: >> >> - patch 1 introduces some counting scheme that patch 4 then changes, could we do >> this in one step to avoid the churn? >> >> - the series addresses the concern that spinlock is being held, but doesn't >> address the fact that counting partial per-node slabs is not nearly enough if we >> want accurate in /proc/slabinfo because there are also percpu >> slabs and per-cpu partial slabs, where we don't track the free objects at all. >> So after this series while the readers of /proc/slabinfo won't block the >> spinlock, they will get the same garbage data as before. So Christoph is not >> wrong to say that we can just report active_objs == num_objs and it won't >> actually break any ABI. > > If maintainers don't mind this inaccuracy which I also doubt its > importance, then it becomes easy. For fear that some people who really > cares, introducing an extra config(default-off) for it would be a good > option. Great. >> At the same time somebody might actually want accurate object statistics at the >> expense of peak performance, and it would be nice to give them such option in >> SLUB. Right now we don't provide this accuracy even with CONFIG_SLUB_STATS, >> although that option provides many additional tuning stats, with additional >> overhead. >> So my proposal would be a new config for "accurate active objects" (or just tie >> it to CONFIG_SLUB_DEBUG?) that would extend the approach of percpu counters in >> patch 4 to all alloc/free, so that it includes percpu slabs. Without this config >> enabled, let's just report active_objs == num_objs. > For percpu slabs, the numbers can be retrieved from the existing > slub_percpu_partial()->pobjects, looks no need extra work. Hm, unfortunately it's not that simple, the number there is a snapshot that can become wildly inacurate afterwards.