Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp114778pxb; Thu, 14 Jan 2021 01:07:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx01V+o7MM1/u9rV6L4A7/x/68sdMjwkMjVfNlx7x9LVhhagSC2hMnGCi89s0cepzD2koRS X-Received: by 2002:a17:906:af92:: with SMTP id mj18mr4185100ejb.290.1610615240473; Thu, 14 Jan 2021 01:07:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610615240; cv=none; d=google.com; s=arc-20160816; b=YfmmqbLIks85C9aYzNh2nUZJqPqJEPuKPuem89heHT8TfqjxBvSTdlQZx1ENseaMx9 ElwwQmskhsbHPgBdgzQ/SP5pXMoaDhk7irwbdJZqezT69gg7Mumk2/VeWn949ffpq7Ei OSO4qebzSDrElLgVhRf+N1/H1aMLHUeFId87du/r4/QhMLFudwyKrxuvqaPoz3uBheD9 MRPwaiLjVyFb9gNkGY9UoxYx6fKLseYkzTY8Ib5i3/11PTCyJeMLIPP6S5tou9+EZ0gr 57y34ifjBqh4s0Qw3OQfW7XbdodJaWH0fl8HmDo357JqP9xQnnEaPU2WXEXJwOf8HY7j RyAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=HBl51V9xRLKPpz2WIgZP7YeMwtOuW32eGtKNY/MmKBE=; b=IWcutIebGOKpQOMSpBsUARmhLU5s9kivj0LyFR/ghH5zaA6pnW+ymtSgYU9bWfrU1R 9IeEYIYkdgtFajQ5zMErkF2872X+2Gp7iyfGWzkur7t8suxGHo/vGSoN/hX/krSuiZd4 96anO1wt2A9BnyGB/xgW9ABf7NfB0dE00yXqskSB1ZbTSSLJE+bkqvBCOhtF6wOsY2YP E3uUFgt5RN0gclLK3HsYHZifKp6OoVdspR5YQaw7U/27g7icsPzSYMUImfwr8S9FcBF3 s2s8twDAatxAMzzTSCs9SQx29m9/qTLH4DykTYGafwDJUkmerwh6s6hbZTWFKsQBLArI F2OQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mm17si2306193ejb.131.2021.01.14.01.06.57; Thu, 14 Jan 2021 01:07:20 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727871AbhANJFO (ORCPT + 99 others); Thu, 14 Jan 2021 04:05:14 -0500 Received: from gentwo.org ([3.19.106.255]:51046 "EHLO gentwo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727207AbhANJFM (ORCPT ); Thu, 14 Jan 2021 04:05:12 -0500 Received: by gentwo.org (Postfix, from userid 1002) id 594BA42153; Thu, 14 Jan 2021 09:04:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 56AF342151; Thu, 14 Jan 2021 09:04:26 +0000 (UTC) Date: Thu, 14 Jan 2021 09:04:26 +0000 (UTC) From: Christoph Lameter X-X-Sender: cl@www.lameter.com To: Jann Horn cc: Vlastimil Babka , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Linux-MM , kernel list , Thomas Gleixner , Sebastian Andrzej Siewior , Roman Gushchin , Johannes Weiner , Shakeel Butt , Suren Baghdasaryan , Minchan Kim , Michal Hocko Subject: Re: SLUB: percpu partial object count is highly inaccurate, causing some memory wastage and maybe also worse tail latencies? In-Reply-To: Message-ID: References: <2f0f46e8-2535-410a-1859-e9cfa4e57c18@suse.cz> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Jan 2021, Jann Horn wrote: > Some brainstorming: > > Maybe you could have an atomic counter in kmem_cache_cpu that tracks > the number of empty frozen pages that are associated with a specific > CPU? So the freeing slowpath would do its cmpxchg_double, and if the The latencies of these functions are so low that any additional counter will have significant performance impacts. An atomic counter would be waay out there. > You could additionally have a plain percpu counter, not tied to the The performance critical counters are already all per cpu. I enhanced the percpu subsystem specifically to support latency critical operations in the fast path of the slab allocators.