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.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,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 9359AC433E1 for ; Mon, 24 Aug 2020 09:59:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3226A20639 for ; Mon, 24 Aug 2020 09:59:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3226A20639 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B19236B0002; Mon, 24 Aug 2020 05:59:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC9406B0005; Mon, 24 Aug 2020 05:59:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DF106B0006; Mon, 24 Aug 2020 05:59:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 874FD6B0002 for ; Mon, 24 Aug 2020 05:59:56 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3991F1EF1 for ; Mon, 24 Aug 2020 09:59:56 +0000 (UTC) X-FDA: 77185015992.07.earth51_2013e2627052 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 82BFE1803F9B3 for ; Mon, 24 Aug 2020 09:59:55 +0000 (UTC) X-HE-Tag: earth51_2013e2627052 X-Filterd-Recvd-Size: 4378 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Mon, 24 Aug 2020 09:59:52 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0U6g21Wa_1598263186; Received: from xunleideMacBook-Pro.local(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0U6g21Wa_1598263186) by smtp.aliyun-inc.com(127.0.0.1); Mon, 24 Aug 2020 17:59:47 +0800 Reply-To: xlpang@linux.alibaba.com Subject: Re: [PATCH 1/2] mm/slub: Introduce two counters for the partial objects To: Pekka Enberg , Christopher Lameter Cc: Vlastimil Babka , Andrew Morton , Wen Yang , Yang Shi , Roman Gushchin , "linux-mm@kvack.org" , LKML , Konstantin Khlebnikov , David Rientjes References: <1593678728-128358-1-git-send-email-xlpang@linux.alibaba.com> From: xunlei Message-ID: <9811b473-e09f-c2aa-cdd8-c71c34fe4707@linux.alibaba.com> Date: Mon, 24 Aug 2020 17:59:46 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 82BFE1803F9B3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 2020/8/20 PM9:58, Pekka Enberg wrote: > Hi Christopher, > > On Tue, Aug 11, 2020 at 3:52 PM Christopher Lameter wrote: >> >> On Fri, 7 Aug 2020, Pekka Enberg wrote: >> >>> Why do you consider this to be a fast path? This is all partial list >>> accounting when we allocate/deallocate a slab, no? Just like >>> ___slab_alloc() says, I assumed this to be the slow path... What am I >>> missing? >> >> I thought these were per object counters? If you just want to count the >> number of slabs then you do not need the lock at all. We already have a >> counter for the number of slabs. > > The patch attempts to speed up count_partial(), which holds on to the > "n->list_lock" (with IRQs off) for the whole duration it takes to walk > the partial slab list: > > spin_lock_irqsave(&n->list_lock, flags); > list_for_each_entry(page, &n->partial, slab_list) > x += get_count(page); > spin_unlock_irqrestore(&n->list_lock, flags); > > It's counting the number of *objects*, but the counters are only > updated in bulk when we add/remove a slab to/from the partial list. > The counter updates are therefore *not* in the fast-path AFAICT. > > Xunlei, please correct me if I'm reading your patches wrong. Yes, it's all in slow-path. > > On Tue, Aug 11, 2020 at 3:52 PM Christopher Lameter wrote: >>> No objections to alternative fixes, of course, but wrapping the >>> counters under CONFIG_DEBUG seems like just hiding the actual issue... >> >> CONFIG_DEBUG is on by default. It just compiles in the debug code and >> disables it so we can enable it with a kernel boot option. This is because >> we have had numerous issues in the past with "production" kernels that >> could not be recompiled with debug options. So just running the prod >> kernel with another option will allow you to find hard to debug issues in >> a full scale producton deployment with potentially proprietary modules >> etc. > > Yeah, it's been too long since I last looked at the code and did not > realize even count_partial() is wrapped in CONFIG_DEBUG. So by all Besides CONFIG_DEBUG, count_partial() is also wrapped in CONFIG_SYSFS. > means, let's also wrap the counters with that too. > > - Pekka >