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.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,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 21827C433E0 for ; Mon, 10 Aug 2020 11:56:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B7C9D206C3 for ; Mon, 10 Aug 2020 11:56:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7C9D206C3 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 47A1E6B0003; Mon, 10 Aug 2020 07:56:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 42A066B0005; Mon, 10 Aug 2020 07:56:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F0CD6B0006; Mon, 10 Aug 2020 07:56:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id 16EDE6B0003 for ; Mon, 10 Aug 2020 07:56:39 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C81FA181AC9CB for ; Mon, 10 Aug 2020 11:56:38 +0000 (UTC) X-FDA: 77134506876.11.toy44_2f0f8d226fda Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 9FA03180F8B80 for ; Mon, 10 Aug 2020 11:56:38 +0000 (UTC) X-HE-Tag: toy44_2f0f8d226fda X-Filterd-Recvd-Size: 3955 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Mon, 10 Aug 2020 11:56:37 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01355;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0U5LoBgT_1597060590; Received: from xunleideMacBook-Pro.local(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0U5LoBgT_1597060590) by smtp.aliyun-inc.com(127.0.0.1); Mon, 10 Aug 2020 19:56:31 +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: Date: Mon, 10 Aug 2020 19:56:30 +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 X-Rspamd-Queue-Id: 9FA03180F8B80 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable 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/8 =E4=B8=8A=E5=8D=881:28, Pekka Enberg wrote: > Hi Christopher, >=20 > On Fri, 7 Aug 2020, Pekka Enberg wrote: >>> I think we can just default to the counters. After all, if I >>> understood correctly, we're talking about up to 100 ms time period >>> with IRQs disabled when count_partial() is called. As this is >>> triggerable from user space, that's a performance bug whatever way yo= u >>> look at it. >=20 > On Fri, Aug 7, 2020 at 4:02 PM Christopher Lameter wrote= : >> Well yes under extreme conditions and this is only happening for sysfs >> counter retrieval. >=20 > You will likely get some stall even in less extreme conditions, and in > any case, the kernel should not allow user space to trigger such a > stall. >=20 Yes, agree. This problem has been causing lots of trouble to us and other people, and should be fixed. Either my approach or the approach provided by "Vlastimil Babka" [1] is better than doing nothing. [1]: https://lore.kernel.org/linux-mm/158860845968.33385.4165926113074799048.s= tgit@buzz/ > On Fri, Aug 7, 2020 at 4:02 PM Christopher Lameter wrote= : >> There could be other solutions to this. This solution here is penalizi= ng >> evertu hotpath slab allocation for the sake of relatively infrequently >> used counter monitoring. There the possibility of not traversing the l= ist >> ande simply estimating the value based on the number of slab pages >> allocated on that node. >=20 > 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? The only hot path is __slab_free(), I've made an extra patch with percpu counter to avoid the potential performance degradation, will send v2 out for review. >=20 > No objections to alternative fixes, of course, but wrapping the > counters under CONFIG_DEBUG seems like just hiding the actual issue... >=20 > - Pekka >=20