Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4248061pxa; Mon, 10 Aug 2020 04:59:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+DdD1fhzT0GtR7Kx/FggzhuyWhgJ8pH5eoaJxWsYGhlgmMmc8UP1/oJGkW8loFiaY9f6O X-Received: by 2002:aa7:ce90:: with SMTP id y16mr21033523edv.325.1597060792784; Mon, 10 Aug 2020 04:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597060792; cv=none; d=google.com; s=arc-20160816; b=v/TJ2umGrTgdL0Of09w+55hcqxxJdvxoNLBNf2HoZHt0Q6JQCvWDSHhT/wjDu0YQSg dWcE6b7vG6r5EgUAyaKKZ9/6OB+efFyudJFPlRgnleuFic8pmJTARh1YNcdQN/dGJw6i sW0q0TpDKJshT/tvhOp8dBI3Ikg3ZU63Cdz8IdFq7Pq790sot7U9EHSjoC/Z3qzEWoDl /qeKXxGc8breMvnoifsNB1z2iHJAjNIOMqlAVAM1GQMYuak6gMGolqUEyvHJGeanBOak e1/y7Vowfu6gHirAYXB2tozN0JLUbVDIJumCZLxf69XhUDdVq9aSzNgFlrI4q/4srmVs uArA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:reply-to; bh=AkWI735vud8WZuiPHjc0X8S914iA5AWLzJWyIx7VTnI=; b=gYy3RrcMaL9JX+tyF1mgqtoxqY8WqexWGnKJAZ6jILJE1HnbOaXy3OXoHIYJmj/QC7 OoP93rnClOtRRuF6+r3vio3qv5p/r0Fk/ubtTm09/GrFZf8W0wKIP4wuioL+T/O8zQZQ LYePuNQbVg9oc4LevX280Jn0NuC43SN8asCwgbAiwkwLJoCI2d/mFKnb+mSaoCc2mPx4 CuFePozGzWFeTgYZMusfqAeugeP9nnObTnMZ1WhlUVlosHAkFcqr/UCcq1b+PXjuEZnv nHCsh8H7OP8QlyX3LOaEvIM/mzNTcTcOd7ZF+mAMeSgOc7vi4/gGvTd/GCXCvZSH7eAj Pi/g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si10252499ejt.607.2020.08.10.04.59.29; Mon, 10 Aug 2020 04:59:52 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726577AbgHJL4i (ORCPT + 99 others); Mon, 10 Aug 2020 07:56:38 -0400 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:48126 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726398AbgHJL4i (ORCPT ); Mon, 10 Aug 2020 07:56:38 -0400 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/8/8 上午1:28, Pekka Enberg wrote: > Hi Christopher, > > 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 you >>> look at it. > > 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. > > 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. > 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.stgit@buzz/ > On Fri, Aug 7, 2020 at 4:02 PM Christopher Lameter wrote: >> There could be other solutions to this. This solution here is penalizing >> evertu hotpath slab allocation for the sake of relatively infrequently >> used counter monitoring. There the possibility of not traversing the list >> ande simply estimating the value based on the number of slab pages >> allocated on that node. > > 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. > > No objections to alternative fixes, of course, but wrapping the > counters under CONFIG_DEBUG seems like just hiding the actual issue... > > - Pekka >