Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1017610pxb; Fri, 22 Jan 2021 05:21:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyMd3XrVmfuCsrZZnSM+eTi6jj9olevxKB1M59ZdJrIoyUmoE1pMxlNa/nOT8AKerkkU3U X-Received: by 2002:a17:906:3b44:: with SMTP id h4mr3087669ejf.414.1611321684331; Fri, 22 Jan 2021 05:21:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611321684; cv=none; d=google.com; s=arc-20160816; b=zIoX/+siHlvQbFiCGLRXxubqmxyk1Q7LBqOzfXVI/UtElQC4rV8JXPSmxnmrz5GDF4 aWC+ZkNQZTMdhVtLlwpji6oS4B5O4pRL/HLtSprCdG0xGvUa3Msr3EcAjwabc0BmG32s dUFr1bxLysIaInjKpLHnI5HibiaQIN077xQeZVQSWLHEzpVj1Rncfs7gTDk5eza+TL58 AUqR61sZ8TiFnAi9yUI1Ws0jmj58TKwMurng0h5I+BDslqKLr8B3xZGxeT3ApgWYhwhE bh5TuEZAenvrx9hGR8L8NqOWupwfwnc2LtYbCN0D+mgvS/rVxmMJ4vxLXo4KFkLoMxFP 5FLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1v2FAdAIM+FduQLY9fgZwr7tF6/Isi2KlND7ig2PLqM=; b=LldNyixQLgDDeOIpjSK0HtxA7c/G3dNXndbUtbESMQzWYLUj7phWgkOX1SzNi7ISFG XdpWta2P7Wyu8vQJ4jAjJcggokJ3fWdr031VhgYuqT6gbK1v6u6BfEkc5gAKti4savGy YSuXDVtSU44yIha0AGtR6eMl0pnBHd3NxOc5YXDR2SH+5d0WcJXsJsPJpQ1MN/mQNFK8 SiVdlxlb/eKozIPFF3rvOVaZy+7OorXT7XCcUi6eulZQxt1tvjAG2WE6skUsCcx9jsnU KiGPTTBEpbLX+WbuRUe2Qam51boR7CA67UIHCBfag8aRB8jPKtGtouDv1JinHlhhkXp8 75ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w65sROKB; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ho20si405885ejc.467.2021.01.22.05.20.58; Fri, 22 Jan 2021 05:21:24 -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; dkim=pass header.i=@linaro.org header.s=google header.b=w65sROKB; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727431AbhAVNRK (ORCPT + 99 others); Fri, 22 Jan 2021 08:17:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727401AbhAVNRF (ORCPT ); Fri, 22 Jan 2021 08:17:05 -0500 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4542C06174A for ; Fri, 22 Jan 2021 05:16:24 -0800 (PST) Received: by mail-lj1-x231.google.com with SMTP id f2so1255586ljp.11 for ; Fri, 22 Jan 2021 05:16:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1v2FAdAIM+FduQLY9fgZwr7tF6/Isi2KlND7ig2PLqM=; b=w65sROKBqsor9zfqRpfltZ34/wM853Cw2NXBuRcrS5fYxv/d2nceN68WoCJYvFVGoh krEbKtoXibVHrjj1toHnXg9oBfFeOT2V8UTDDtG84gaRlJk0VPT2XhXzHi9HKL9/Byn3 zTOV+lhC4xDAgmZQZczTdURgv4OnednJAug7hzkH63lMFprGrvad1FHUV1DO3N5/Y2ut R1ilFeGGEuJQE251rWv1/Q1ukRwGMg1UadZSwxTDfmYucOZbuoaRajZ5K3+DU/FFOcoq H+UMa41hui9M/D7u6I+yXBmO/oY31aSQyWQTRSCxtj38sDe3NqP5W6HHGOTpzA0TdSsM xNxQ== 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=1v2FAdAIM+FduQLY9fgZwr7tF6/Isi2KlND7ig2PLqM=; b=CiGudiPJvpHP91n936BjwxvcyQoDN7dArAscKy8pqaivkA1vL4pfx7Rq5rp2FDl/3Z +bwGC5gLWLfZTuG028xJ6aD7EY4Yjq+fQcNlMRluKt8FKwlBB+VDpEnmvzPSdITv9K8V 0uRKnOCfK2aFNhGaSmIczhUJcyqBUB9NKtn5okJOicJwEIQmmUajoxhG35biqtNII2Dj ZS1KX9KCwDHJIUPiSXgFT5JuAVY8PYhrOyKKUenLzpE+6kVblbnSzMVzsur1miR7lnz1 t5xDGt8O8bBeCwOWp9bPWvXSgMWYKXpn4QdmUx0B6b6a7xgW1NmXwOuKzw6LauL6LwPb lozA== X-Gm-Message-State: AOAM532XUmZ9B3YiidWV0tzFvEd6QuHvdYp5k4lPcwHr7sJFsv5482P7 Yusu6MjmJIk30ccLTuKTiIl5Wsj8WP2WQtYB7k7KxsV8twRmXQ== X-Received: by 2002:a2e:b6cc:: with SMTP id m12mr837848ljo.401.1611321383077; Fri, 22 Jan 2021 05:16:23 -0800 (PST) MIME-Version: 1.0 References: <20201118082759.1413056-1-bharata@linux.ibm.com> <20210121053003.GB2587010@in.ibm.com> <786571e7-b9a2-4cdb-06d5-aa4a4b439b7e@suse.cz> In-Reply-To: <786571e7-b9a2-4cdb-06d5-aa4a4b439b7e@suse.cz> From: Vincent Guittot Date: Fri, 22 Jan 2021 14:16:11 +0100 Message-ID: Subject: Re: [RFC PATCH v0] mm/slub: Let number of online CPUs determine the slub page order To: Vlastimil Babka Cc: Christoph Lameter , Bharata B Rao , linux-kernel , linux-mm@kvack.org, David Rientjes , Joonsoo Kim , Andrew Morton , guro@fb.com, Shakeel Butt , Johannes Weiner , aneesh.kumar@linux.ibm.com, Jann Horn , Michal Hocko Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Jan 2021 at 13:03, Vlastimil Babka wrote: > > On 1/22/21 9:03 AM, Vincent Guittot wrote: > > On Thu, 21 Jan 2021 at 19:19, Vlastimil Babka wrote: > >> > >> On 1/21/21 11:01 AM, Christoph Lameter wrote: > >> > On Thu, 21 Jan 2021, Bharata B Rao wrote: > >> > > >> >> > The problem is that calculate_order() is called a number of times > >> >> > before secondaries CPUs are booted and it returns 1 instead of 224. > >> >> > This makes the use of num_online_cpus() irrelevant for those cases > >> >> > > >> >> > After adding in my command line "slub_min_objects=36" which equals to > >> >> > 4 * (fls(num_online_cpus()) + 1) with a correct num_online_cpus == 224 > >> >> > , the regression diseapears: > >> >> > > >> >> > 9 iterations of hackbench -l 16000 -g 16: 3.201sec (+/- 0.90%) > >> > >> I'm surprised that hackbench is that sensitive to slab performance, anyway. It's > >> supposed to be a scheduler benchmark? What exactly is going on? > >> > > > > From hackbench description: > > Hackbench is both a benchmark and a stress test for the Linux kernel > > scheduler. It's main > > job is to create a specified number of pairs of schedulable > > entities (either threads or > > traditional processes) which communicate via either sockets or > > pipes and time how long it > > takes for each pair to send data back and forth. > > Yep, so I wonder which slab entities this is stressing that much. > > >> Things would be easier if we could trust *on all arches* either > >> > >> - num_present_cpus() to count what the hardware really physically has during > >> boot, even if not yet onlined, at the time we init slab. This would still not > >> handle later hotplug (probably mostly in a VM scenario, not that somebody would > >> bring bunch of actual new cpu boards to a running bare metal system?). > >> > >> - num_possible_cpus()/nr_cpu_ids not to be excessive (broken BIOS?) on systems > >> where it's not really possible to plug more CPU's. In a VM scenario we could > >> still have an opposite problem, where theoretically "anything is possible" but > >> the virtual cpus are never added later. > > > > On all the system that I have tested num_possible_cpus()/nr_cpu_ids > > were correctly initialized > > > > large arm64 acpi system > > small arm64 DT based system > > VM on x86 system > > So it's just powerpc that has this issue with too large nr_cpu_ids? Is it caused > by bios or the hypervisor? How does num_present_cpus() look there? num_present_cpus() starts to 1 until secondary cpus boot in the arm64 case > > What about heuristic: > - num_online_cpus() > 1 - we trust that and use it > - otherwise nr_cpu_ids > Would that work? Too arbitrary? > > > >> We could also start questioning the very assumption that number of cpus should > >> affect slab page size in the first place. Should it? After all, each CPU will > >> have one or more slab pages privately cached, as we discuss in the other > >> thread... So why make the slab pages also larger? > >> > >> > Or the num_online_cpus needs to be up to date earlier. Why does this issue > >> > not occur on x86? Does x86 have an up to date num_online_cpus earlier? > >> > > >> > > >> > > >