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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 1B873C433E0 for ; Mon, 25 Jan 2021 11:20:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7AA0D22795 for ; Mon, 25 Jan 2021 11:20:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AA0D22795 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B8E798D0006; Mon, 25 Jan 2021 06:20:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B3F878D0001; Mon, 25 Jan 2021 06:20:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A06A38D0006; Mon, 25 Jan 2021 06:20:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id 890368D0001 for ; Mon, 25 Jan 2021 06:20:17 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4D6DE180ACF84 for ; Mon, 25 Jan 2021 11:20:17 +0000 (UTC) X-FDA: 77744053674.10.lake98_020bcd227585 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 27AE516A047 for ; Mon, 25 Jan 2021 11:20:17 +0000 (UTC) X-HE-Tag: lake98_020bcd227585 X-Filterd-Recvd-Size: 5349 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 Jan 2021 11:20:16 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5330DB9A3; Mon, 25 Jan 2021 11:20:15 +0000 (UTC) To: Vincent Guittot , Bharata B Rao Cc: Christoph Lameter , 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 , Catalin Marinas , Will Deacon References: <20201118082759.1413056-1-bharata@linux.ibm.com> <20210121053003.GB2587010@in.ibm.com> <786571e7-b9a2-4cdb-06d5-aa4a4b439b7e@suse.cz> <20210123051607.GC2587010@in.ibm.com> From: Vlastimil Babka Subject: Re: [RFC PATCH v0] mm/slub: Let number of online CPUs determine the slub page order Message-ID: <66652406-25e4-a9e7-45a1-8ad14d2e8a36@suse.cz> Date: Mon, 25 Jan 2021 12:20:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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 1/23/21 1:32 PM, Vincent Guittot wrote: >> PowerPC PowerNV Host: (160 cpus) >> num_online_cpus 1 num_present_cpus 160 num_possible_cpus 160 nr_cpu_id= s 160 >> >> PowerPC pseries KVM guest: (-smp 16,maxcpus=3D160) >> num_online_cpus 1 num_present_cpus 16 num_possible_cpus 160 nr_cpu_ids= 160 >> >> That's what I see on powerpc, hence I thought num_present_cpus() could >> be the correct one to use in slub page order calculation. >=20 > num_present_cpus() is set to 1 on arm64 until secondaries cpus boot >=20 > arm64 224cpus acpi host: > num_online_cpus 1 num_present_cpus 1 num_possible_cpus 224 nr_cpu_ids 2= 24 > arm64 8cpus DT host: > num_online_cpus 1 num_present_cpus 1 num_possible_cpus 8 nr_cpu_ids 8 > arm64 8cpus qemu-system-aarch64 (-smp 8,maxcpus=3D256) > num_online_cpus 1 num_present_cpus 1 num_possible_cpus 8 nr_cpu_ids 8 I would have expected num_present_cpus to be 224, 8, 8, respectively. > Then present and online increase to num_possible_cpus once all cpus are= booted >=20 >> >> > >> > What about heuristic: >> > - num_online_cpus() > 1 - we trust that and use it >> > - otherwise nr_cpu_ids >> > Would that work? Too arbitrary? >> >> Looking at the following snippet from include/linux/cpumask.h, it >> appears that num_present_cpus() should be reasonable compromise >> between online and possible/nr_cpus_ids to use here. >> >> /* >> * The following particular system cpumasks and operations manage >> * possible, present, active and online cpus. >> * >> * cpu_possible_mask- has bit 'cpu' set iff cpu is populatable >> * cpu_present_mask - has bit 'cpu' set iff cpu is populated >> * cpu_online_mask - has bit 'cpu' set iff cpu available to sched= uler >> * cpu_active_mask - has bit 'cpu' set iff cpu available to migra= tion >> * >> * If !CONFIG_HOTPLUG_CPU, present =3D=3D possible, and active =3D=3D= online. >> * >> * The cpu_possible_mask is fixed at boot time, as the set of CPU id'= s >> * that it is possible might ever be plugged in at anytime during the >> * life of that system boot. The cpu_present_mask is dynamic(*), >> * representing which CPUs are currently plugged in. And >> * cpu_online_mask is the dynamic subset of cpu_present_mask, >> * indicating those CPUs available for scheduling. >> * >> * If HOTPLUG is enabled, then cpu_possible_mask is forced to have >> * all NR_CPUS bits set, otherwise it is just the set of CPUs that >> * ACPI reports present at boot. >> * >> * If HOTPLUG is enabled, then cpu_present_mask varies dynamically, >> * depending on what ACPI reports as currently plugged in, otherwise >> * cpu_present_mask is just a copy of cpu_possible_mask. >> * >> * (*) Well, cpu_present_mask is dynamic in the hotplug case. If not >> * hotplug, it's a copy of cpu_possible_mask, hence fixed at boot= . >> */ >> >> So for host systems, present is (usually) equal to possible and for >=20 > But "cpu_present_mask varies dynamically, depending on what ACPI > reports as currently plugged in" >=20 > So it should varies when secondaries cpus are booted Hm, but booting the secondaries is just a software (kernel) action? They = are already physically there, so it seems to me as if the cpu_present_mask is= not populated correctly on arm64, and it's just a mirror of cpu_online_mask?