Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp582844pxb; Wed, 27 Jan 2021 15:50:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwXiP5I70hCBB3H6sJiIGyvpPtYAtQEF2Vr+i/TpptoG47uFCTTYKFmIc1r2WTngEuENKy X-Received: by 2002:a05:6402:143d:: with SMTP id c29mr11295968edx.274.1611791409098; Wed, 27 Jan 2021 15:50:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611791409; cv=none; d=google.com; s=arc-20160816; b=fPTAqd+PTMJxf1NumAydZT+AfFAuLTWBfarSgppNIiW64WE9Jwwod73a1fdxFA5m1k ePwvyrtfNzEoxvTF73InwPaYSh+ytdCuNb6dHEaq52N2ApycI7k44lRD/zJS95KZLyef utULPc03kKfxcli/wkuCC5QD05oy0j+KULfK7O8HReYTppGh+F3QTROj/EEXYPszFrRe 8wXNOXgmCYv1+RL2qHJ5ajjbWCB2gverUTYHcGHk8/e+2ZtfkQgvQquOwp2odB7Smmox lS8QSxMLpiyyPc6ZgXt+1K7Jre14yL2cdFtnNKYDSJwlpZzxOUwG4rJUFpZgBBoasWJ7 d9VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to; bh=9yglH95uWN4D/ZwYVbs9rpPS2He19GR56AIFmHOXk80=; b=J1peOFwfy0alvvR2+3ZR5jX1+IszHs0+BngXe5/SWAwcDCvImfwWh8VEAD/UYHUi9r j+mLMf9XZjU6PmzNhGP85FmUlLBmxXau0N1bh/+ke+ZEGOh47qSQciQiDcT/Tr5zrcte 5LOhTwErtAYjd0/xeow9Vy5QMzief3UMuIuPmNO1gsFHQfcCQDXQbzcM5Jl/AnBq/Aqg kW7UQa/RoT7WLTP0EqvZR+fP5x0qLY5ZuxoBBljdUqZ1fGzndb72OEQC4ktoPFTd3HWS zEDnI8Jov5O2uN8Vrsf7rJNPm53WMZj+bMmHT2MJw1jHFBgmX0OvFX1yAALN+T+cvZrl 0rzg== 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 u15si1714111edt.339.2021.01.27.15.49.05; Wed, 27 Jan 2021 15:50:09 -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 S236408AbhA0LHP (ORCPT + 99 others); Wed, 27 Jan 2021 06:07:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:51290 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235983AbhA0LEs (ORCPT ); Wed, 27 Jan 2021 06:04:48 -0500 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 339FAACBA; Wed, 27 Jan 2021 11:04:05 +0000 (UTC) To: Christoph Lameter , Will Deacon Cc: Vincent Guittot , 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 , Catalin Marinas 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> <66652406-25e4-a9e7-45a1-8ad14d2e8a36@suse.cz> <20210126230305.GD30941@willie-the-truck> From: Vlastimil Babka Subject: Re: [RFC PATCH v0] mm/slub: Let number of online CPUs determine the slub page order Message-ID: <81424d71-c479-4c4a-de14-0a9b3f636e23@suse.cz> Date: Wed, 27 Jan 2021 12:04:01 +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: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/27/21 10:10 AM, Christoph Lameter wrote: > On Tue, 26 Jan 2021, Will Deacon wrote: > >> > 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? >> >> I think the present_mask retains CPUs if they are hotplugged off, whereas >> the online mask does not. We can't really do any better on arm64, as there's >> no way of telling that a CPU is present until we've seen it. > > The order of each page in a kmem cache --and therefore also the number > of objects in a slab page-- can be different because that information is > stored in the page struct. > > Therefore it is possible to retune the order while the cache is in operaton. Yes, but it's tricky to do the retuning safely, e.g. if freelist randomization is enabled, see [1]. But as a quick fix for the regression, the heuristic idea could work reasonably on all architectures? - if num_present_cpus() is > 1, trust that it doesn't have the issue such as arm64, and use it - otherwise use nr_cpu_ids Long-term we can attempt to do the retuning safe, or decide that number of cpus shouldn't determine the order... [1] https://lore.kernel.org/linux-mm/d7fb9425-9a62-c7b8-604d-5828d7e6b1da@suse.cz/ > This means you can run an initcall after all cpus have been brought up to > set the order and number of objects in a slab page differently. > > The older slab pages will continue to exist with the old orders until they > are freed. >