Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2016830pxa; Fri, 7 Aug 2020 00:27:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWBaNLPqefmrOSwryf12ERuAkBjXcmpFzTlctgyjlR9t0gp5fHagoHN16ieBo/wTRHqE30 X-Received: by 2002:a17:906:4a4e:: with SMTP id a14mr8259275ejv.450.1596785235823; Fri, 07 Aug 2020 00:27:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596785235; cv=none; d=google.com; s=arc-20160816; b=CAEgt02uZQBwhnMYgAcqr3DFyOhZZZPbgj2az/A9ANrP17shdk3FXK3xfKWkuVstpQ esxTvscTbQQ4m8kGYa+UgxCL6bULzc3BQyJrgT1zZJqCRFzuMY7reDj1e4pTDzxQrcqL nUV0edsPCi8JxnyKCNOJBhbx7nExRTUkIv+X1FeJp8qIPHT95i0jtw/6kUlrniVLppZy ueUb5o2yEXw2JavDFCyZU6J89eMD9r1KBnyF7J46m3kST3cavdR9bRs+LwDPB+4XN3Qn ZqMN0VoH61Nrs+3g1Xz8Cy6SXnGxbxvPuFQldxjxQnE5bALW3bq20rxYa5khVS9J1BEO l7sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VuGyNraoSZkaqmXZxN0xTeDtESMeo0rZS6+yyQYUjVo=; b=E9OlJ+1hXinYvSvHFe667R5WQgGWwRME9Mdlmyh5I+6w5Bi7AUkUJE5ZrzMT0dwCDM O+XR2c9UkgVfhHigYtv/MTMkEWimAXzSFcjGUZoHO57tXzgTmkNxDonNgMpVabzxUjVa FG8vQ3A4iVNO1W2OAgKb5il7zfaluJzLscba4ZheUExVGSVzOgGoVkTXl+N33EtPG2wx 6OVRsLR4hQljPHTSj/BqcgLJprug/n523+EroDRmlcGCT2DMGxEHvC00GJMRgqcKo1HS 5ZmGdBYTc+RMlDOEMKGOQeAKeJC1ehtuLJE40UH1ikqzB9wVv6Wk4utkuyjCt+szjgMY bcdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Nra8smWX; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si4837442edt.52.2020.08.07.00.26.52; Fri, 07 Aug 2020 00:27:15 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Nra8smWX; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726514AbgHGH0R (ORCPT + 99 others); Fri, 7 Aug 2020 03:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgHGH0Q (ORCPT ); Fri, 7 Aug 2020 03:26:16 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E81C061574 for ; Fri, 7 Aug 2020 00:26:16 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id z18so892891otk.6 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=DFRBaYBoOBdn6OCNcp1LBp9YVVOFTa4KRHhGvjnYaWA5B/smKgTFmhc+6bL2CHq1eD XL5ZsdwQtSVAvOIluDE45b6be3QF/4LQet1G3X2ceslJ91qq+AGlhEeiw7mFvEDOiXqf U0DfJ+1BSvu3XOpeU9zq3cK3cpLc1TSfCK8cRGXcsM22+52FjglEkh/BvFtZgSU9wjka tLLd6kwFRVu6LSyrJXXgEnd4OVDLDNq6Zwe2ItgfquQ+Ya7rOyt8xdywEmurlvOFaOKQ HF4wbprPozSRfQ7J8U6qq+g0DDw65WQ7emNowkSWJHxkh8rr1JqFpD42T5XM8VwLEHG+ CoOA== X-Gm-Message-State: AOAM530MsNyDn2fpAg4MeUyLFj/YSsZGd/7/oXtOmDbk8H2WEz9SYDeZ SZReGUWfGpxpcc5IhNVHXXxeNR3afNY2qlfbXso= 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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