Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4228762pxf; Tue, 16 Mar 2021 08:30:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1yLsbywzmnyzp5UxDffao4Urqei+vfBg0gsfc5hIJgSUmw6zjF+psRBzAIa1caFKBJ78s X-Received: by 2002:a05:6402:382:: with SMTP id o2mr37572701edv.238.1615908600156; Tue, 16 Mar 2021 08:30:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615908600; cv=none; d=google.com; s=arc-20160816; b=obFSSZbUvUD6kkIjYnW80M+IV+VAI+fSPnbtMjnzQuAUCjNw0HVOCfnDYYVKUKy2Za lyinJ+zmax4U8hV86U0wY6n6AvOxu3+FJnvtZ5FBH40fVHNTLJr1wSKhci7eTJawNKb+ 9CKk1pPKa5GQJsVRGaQ59TkmR3ZXMHUUq+vzUkNCns+tiNnHEHsGFb3cZ/D9ZWK6BQO0 2oJ8iVdsxAXgxG5MAMEAI9T4BC54DZGRGZ//u78i+3DCv24heOK1p/OxXCFx68HLfmID a4PUrPZdWrKxR5vIQOh7TrlbBw3OP5GmTWTetOep8JzHzjMLEcfO2a2IULddDiUvyxuv fFhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Oacp62R+xWktgCWzHV8Rq+A4MLEEYmWXKj+M0JsDn1U=; b=pxEcPP69WFIrFTxyPdLFccfM6LZ75r0/zLwm7VINcYCkKl1eRAleln08nfiLWIDsk9 rtbyYoykLPZRV4vJHYuSP5XTpPPjn3AaQz+5jTFvqmy2GS6alNmgaPeIpihVBRqMqj/B 1OfiExq9zTSrwMNffsCIsfqVHa1IQjB2P104MmkEU4qLgP+ObGUamhslVwFSCASPDzpL hTVC/bFJNtNmGvRGqDCnqvRGqI9TVzN8N6hLobaEOXIHSzmfph/BCYjbuG3OAiTL3cu2 jkIVDi38NaeEM679XMzoIbPWCb9wsoOLg+vS6Oa48tTpyI92Vm9cGSiZybYHCqob2WEe EECA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si5745821edd.128.2021.03.16.08.29.37; Tue, 16 Mar 2021 08:30:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237018AbhCPLDK (ORCPT + 99 others); Tue, 16 Mar 2021 07:03:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:39298 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbhCPLCv (ORCPT ); Tue, 16 Mar 2021 07:02:51 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.