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=-3.6 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,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 18F98C433DF for ; Thu, 20 Aug 2020 13:58:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CA95C20738 for ; Thu, 20 Aug 2020 13:58:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M2wcRAlV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA95C20738 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 63EF58D001C; Thu, 20 Aug 2020 09:58:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C7B78D0002; Thu, 20 Aug 2020 09:58:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 491138D0024; Thu, 20 Aug 2020 09:58:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id 2CDFA8D0002 for ; Thu, 20 Aug 2020 09:58:51 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D3D4D824805A for ; Thu, 20 Aug 2020 13:58:50 +0000 (UTC) X-FDA: 77171102820.19.place47_590ce4727031 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 5326F1ACC2A for ; Thu, 20 Aug 2020 13:58:50 +0000 (UTC) X-HE-Tag: place47_590ce4727031 X-Filterd-Recvd-Size: 5321 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Thu, 20 Aug 2020 13:58:49 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id 93so1525875otx.2 for ; Thu, 20 Aug 2020 06:58:49 -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=27PMKVLomMz0Eib+Dl+VjSzpCmC6idgXY425VL4EzdY=; b=M2wcRAlVkK9M9njr7QiaUuZJLX5lZmAkOrlqu7uqeuzHSvjoRX/QK6sLcI41BdZHqX adfeZZdTjN5tKoJ8S9NL8OLNtJTBmDfHim9j4PE4/4m4g3DTi03Eeoz4wOLJSwN46KSY U/Qq0YxnCNPqTAv16cjFqAKIiyzcuDSHWkPQHgSTehmzEE8X3w3oknQU+24dH4k0u75W 5d6X8YqY27jV4bi+qKzfZz468u0fCCaMcTsGBKBuI2xJ844d/bmOb9GbxjMnLrZcVgIo ORP/W0k0Qc20HotT+GqHnoxIGBtzpC6Ygx/6nyrFTOMlpaJNkyaKlsHoSpBPxoF12ba3 eNHw== 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=27PMKVLomMz0Eib+Dl+VjSzpCmC6idgXY425VL4EzdY=; b=SL5RXC0+W9BzxKJwEu8DVzqyZ8I8ESR3bGBFImoWVlseRlV2vLSphI2IxIZPaU0Kax EMsfW1yrj/dXl6OzRaWV66OybdGNOLlAiqBvd5Endcoip20KDv4Ce8h6POOvlNB9I8TP sJyhc7CK+o0sPEoxcIir/SGdBa/sf7OgPzGauxoxQhtT0hEo7Xyv58qBgZZrp+brO93H S5MzLjpvn/Rjyqyo+NkCEqsFYjUEAbn1BY2Lmq/0oyKDOtWsszH6PRNdPmYf9AcL6UdM xSpar3jAlsduPhU3OGKihbnOpHnxztBE/DmNuYylG1i7e98mY2R8L5pdgdZ95Lj9079u SwAw== X-Gm-Message-State: AOAM531k8lQ0FXkaM9SxOv72LigqO+hlSBsWpi4vC//+qAcUR6DQ0vjq Rf6ys/tvzIS8nZuSwqvT5qIQ8swqGJA3rn7Fl9k= X-Google-Smtp-Source: ABdhPJwqvL4OhDofNZ/5JPAe+gfNClhvEzue3JbT/tcL6lw/ipaETweV616UF1C5h//wOUw6+lqcmUjY8xXC+NYLVuk= X-Received: by 2002:a9d:20c4:: with SMTP id x62mr2027505ota.99.1597931929160; Thu, 20 Aug 2020 06:58:49 -0700 (PDT) MIME-Version: 1.0 References: <1593678728-128358-1-git-send-email-xlpang@linux.alibaba.com> In-Reply-To: From: Pekka Enberg Date: Thu, 20 Aug 2020 16:58:31 +0300 Message-ID: Subject: Re: [PATCH 1/2] mm/slub: Introduce two counters for the partial objects To: Christopher Lameter Cc: Vlastimil Babka , Xunlei Pang , 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: 5326F1ACC2A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: 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. 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 means, let's also wrap the counters with that too. - Pekka