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.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS 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 67FA7C433E5 for ; Fri, 7 Aug 2020 07:26:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1179C20855 for ; Fri, 7 Aug 2020 07:26:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Nra8smWX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1179C20855 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 455968D0091; Fri, 7 Aug 2020 03:26:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 404DF8D0026; Fri, 7 Aug 2020 03:26:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F4958D0091; Fri, 7 Aug 2020 03:26:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id 167D88D0026 for ; Fri, 7 Aug 2020 03:26:17 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id CBDD8362A for ; Fri, 7 Aug 2020 07:26:16 +0000 (UTC) X-FDA: 77122939152.01.elbow37_180ba4426fbe Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id A084F100507AC for ; Fri, 7 Aug 2020 07:26:16 +0000 (UTC) X-HE-Tag: elbow37_180ba4426fbe X-Filterd-Recvd-Size: 4917 Received: from mail-ot1-f67.google.com (mail-ot1-f67.google.com [209.85.210.67]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Aug 2020 07:26:16 +0000 (UTC) Received: by mail-ot1-f67.google.com with SMTP id t7so920465otp.0 for ; Fri, 07 Aug 2020 00:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VuGyNraoSZkaqmXZxN0xTeDtESMeo0rZS6+yyQYUjVo=; b=Nra8smWXTUQe/7+jUQzQohhCEggGdi0HBuH1b9sGFdAUZSgjyxyReplgS1nhH2hLoq eww1XSHt5FvDEXwOgaVL2oJpRnxw7zdPk0PoU0uGUmb0wvqxRv0BrtLU++hdLmUDsI6L 88cp1deBgBhhoXReVyKv3G2Hh8bwXtQxTWW77sBxeKAKoY2OlNUSr6B0TFnK8kWClFXH t8Jt6hIBkXcxeNaiH5vQ1kyij2fxJq88iJ3mWCsOukv+jpDKeLVKi+0V+RvsgtHnF5yg ZaBmZcUMxpreYKMHUcy9ck7YN3Y6EVzSg6L6mMyq0rCKkqNjAOmHmkVEgO8NMhon7uSy zI+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VuGyNraoSZkaqmXZxN0xTeDtESMeo0rZS6+yyQYUjVo=; b=oYPmwwoj42ksKEBnuOIorOXspmxPA45aPyt46OYo6pwni85dAdIgyXM6gr84DZ44th sVy4oxOLStMxb2JSM9BicUyxJ39gSEpUGDbu1mFd1NzoUDKV0KULwMhQe9rBeOtqLOMH UpCEnRABPfvYpPt7Bsj0Iz5FfTuv4ICL3GiH116zlNvkLDzfMiOB39DJCo721qyRwzSO TkhXDRlt+uTm432Rap/aiFDZVCoJqdm6OPZPNbOtBGpEP7qrsY6bQQ5zhJToT/Iqwbi0 n5XB9MhcO8QDB4xZnNKcyGb21RDXqeidncxdneo4ZecwPSDsB1RPiMvkii3Ag+uHrOGi hYUg== X-Gm-Message-State: AOAM5336ygAxhSF7jBVvV/0fxSZsSqKg0yjLU7kvFG0dgMPRD6OpgM1g s8PD8UWlptsB1IKwEfA6/DNK/Ye5OWWVBAvkyFw= X-Google-Smtp-Source: ABdhPJzhdIxqaNWhGYDF1e15qchlE/mSQs7N7tgkFrMgWZmqc6H1qqtEwsOUVSlwTi3dj13zbrQ5Feei/cY6zmJ1XWY= X-Received: by 2002:a05:6830:20d6:: with SMTP id z22mr10774644otq.94.1596785175652; Fri, 07 Aug 2020 00:26:15 -0700 (PDT) MIME-Version: 1.0 References: <1593678728-128358-1-git-send-email-xlpang@linux.alibaba.com> In-Reply-To: From: Pekka Enberg Date: Fri, 7 Aug 2020 10:25:59 +0300 Message-ID: Subject: Re: [PATCH 1/2] mm/slub: Introduce two counters for the partial objects To: Vlastimil Babka Cc: Xunlei Pang , Christoph Lameter , Andrew Morton , Wen Yang , Yang Shi , Roman Gushchin , "linux-mm@kvack.org" , LKML , Konstantin Khlebnikov , David Rientjes Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: A084F100507AC 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 Thu, Aug 6, 2020 at 3:42 PM Vlastimil Babka wrote: > > On 7/2/20 10:32 AM, Xunlei Pang wrote: > > The node list_lock in count_partial() spend long time iterating > > in case of large amount of partial page lists, which can cause > > thunder herd effect to the list_lock contention, e.g. it cause > > business response-time jitters when accessing "/proc/slabinfo" > > in our production environments. > > > > This patch introduces two counters to maintain the actual number > > of partial objects dynamically instead of iterating the partial > > page lists with list_lock held. > > > > New counters of kmem_cache_node are: pfree_objects, ptotal_objects. > > The main operations are under list_lock in slow path, its performance > > impact is minimal. > > > > Co-developed-by: Wen Yang > > Signed-off-by: Xunlei Pang > > This or similar things seem to be reported every few months now, last time was > here [1] AFAIK. The solution was to just stop counting at some point. > > Shall we perhaps add these counters under CONFIG_SLUB_DEBUG then and be done > with it? If anyone needs the extreme performance and builds without > CONFIG_SLUB_DEBUG, I'd assume they also don't have userspace programs reading > /proc/slabinfo periodically anyway? 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. Whoever needs to eliminate these counters from fast-path, can wrap them in a CONFIG_MAKE_SLABINFO_EXTREMELY_SLOW option. So for this patch, with updated information about the severity of the problem, and the hackbench numbers: Acked-by: Pekka Enberg Christoph, others, any objections? - Pekka