Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp118835pxb; Thu, 21 Jan 2021 02:57:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxELIXADsVskij6gexDTKieIifU6YxOR2NQ8iIJp3apnfBRXuANDQkCwoY8AVtXE12btJfr X-Received: by 2002:a05:6402:4c1:: with SMTP id n1mr10678644edw.66.1611226623004; Thu, 21 Jan 2021 02:57:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611226622; cv=none; d=google.com; s=arc-20160816; b=L1WJqWng+9rO6Vzom9IcFf8igl2oZH/SMuR0+d+M/SJSQKB/jeplxqmTHhSEWTJ0eQ 9plG0vQ1Csz3OxyVlisgeDwOtRHPCDbm7zZqutu3FYY6gWBfHZozQtDU516kY1PWrV4O O8PViXbZ1TrgK8qeP7MpaxL9GoEMGV6vmkz4HnMgoriF7VXVheUwzgvr+QgVV3UvYPgN LZJDEqToo4NxEtpC2LxD62uV8k6SQsu6TusKIoiIIZm1YTvLQwheicOHd8hjku4bBKFb fgRv0IEPMX0od10DARTMCRyit/nmkEJJVbA3MSE3UGZrXU+pjX6zUePqp/Xnt6Yqr9lg u/Xw== 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=0Ier3JxTZHCJDYEQcjpwf7m9INPX4qO9DRZJZVH43cY=; b=U//itQwxW8EmyIW1LIDRBACk3GAP/TV3KhqBQHPCxuE5ZqWr0CTK5X/GpppGFOICuV IFPaH8xBSxSCPCeu7sAZL8cjCJvRtDk2AAp8NlMadrOLmHfXcjk+Fhyk2GL738mWfGl4 SyjubwjKM3oVtcLA8OL4L+GPS5v3K3gtpsWN6Tr48sGeBVGAOXm0wB2X2EeeP1i/m4Ry GYtZKQPdeqevYS/SHrxROVY4m5PXJz9XnEGG8bcyKEtcSsxVEQroY6mLsCBC4upz4Qm8 407jw6kRWpSVUm1ssqKeKHyAY7HmltFWuOgTFKsaA5wIFtoEW/V8NVnwn2UoU+YjMSCy sMxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gfULL5MI; 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 g1si2016356edv.264.2021.01.21.02.56.39; Thu, 21 Jan 2021 02:57:02 -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=gfULL5MI; 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 S1728546AbhAUKxg (ORCPT + 99 others); Thu, 21 Jan 2021 05:53:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729839AbhAUKt2 (ORCPT ); Thu, 21 Jan 2021 05:49:28 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65D81C061575 for ; Thu, 21 Jan 2021 02:48:46 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id a8so1865091lfi.8 for ; Thu, 21 Jan 2021 02:48:46 -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=0Ier3JxTZHCJDYEQcjpwf7m9INPX4qO9DRZJZVH43cY=; b=gfULL5MIuBFoS5q6PkTtjGLlOB2s17CQwYZ/9KB3vNhGC7rAe6nQDF7tD09UEazptP XZiDXFxkUKCpOMttLmlJaV42SQqYjRrHBT4adkWmybsJlYhb53DmORNhxFz7lvrPmBxq +TVN/jNSUU32RQQRucdLOckXz405gRmEoIa5LUp3lCE1RYkylrY4KOxgUYG4gOF+RRkO +QxBDjitf6rDbfqCK5PJ4QpHTqr50wHV40bfplQEoYmVeEKNmzPtJuewTFUg7W2ihcqq aOASjt8WBLtcj4F8b0tGIZGlTb+FaW8Tn37iIKpo8E4VWR+CpGrIVaio5lwq7ckHhNQp nFBQ== 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=0Ier3JxTZHCJDYEQcjpwf7m9INPX4qO9DRZJZVH43cY=; b=hDT6F0bOMtTze/521pQIxuZ1VeX9U6xi8tHiHGREmSTzaj6w4igYV6LgKom8KrhsZK 6H5YICztDTk0y0gtwWdwztsYHCBzeGYfrMZWBWb0Y6s+KMybHHB6gNXD8gfxcvawQHLt vQM4PkTjpOID26ROn9DEQv+ai2Y7Bll4izUrkRLPJD0WKNBnl/CEPVDhUnTJPZ5rFzcW 7Ha8XzSWkBApc48/+qu8dQkIUWo0ze9kj1Q+rOoUeTvRmS1pGo7av7SjnVfUz5OrG2vD Jpojwx/zrlaxu9fy60Sem9iGYKVEXAwTWwJY+S3+b2jz0LgaG+yB/wjvynHEB0noVj3t lorA== X-Gm-Message-State: AOAM532/87GS6pl0f/jBjmiwiSmEz/Ns9SGB0NyOG6eLeG0oM3NhlR6n q8fksiRImIFENwms/zkPtg7XSImytrVJxs0i7T5+0A== X-Received: by 2002:a19:2d0a:: with SMTP id k10mr6729312lfj.286.1611226124818; Thu, 21 Jan 2021 02:48:44 -0800 (PST) MIME-Version: 1.0 References: <20201118082759.1413056-1-bharata@linux.ibm.com> <20210121053003.GB2587010@in.ibm.com> In-Reply-To: From: Vincent Guittot Date: Thu, 21 Jan 2021 11:48:33 +0100 Message-ID: Subject: Re: [RFC PATCH v0] mm/slub: Let number of online CPUs determine the slub page order To: Christoph Lameter Cc: Bharata B Rao , linux-kernel , linux-mm@kvack.org, David Rientjes , Joonsoo Kim , Andrew Morton , guro@fb.com, vbabka@suse.cz, Shakeel Butt , Johannes Weiner , aneesh.kumar@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Jan 2021 at 11:01, 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%) > > > > Should we have switched to num_present_cpus() rather than > > num_online_cpus()? If so, the below patch should address the > > above problem. > > There is certainly an initcall after secondaries are booted where we could > redo the calculate_order? > > 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? I have added a printk in calculate_order() : pr_info(" SLUB calculate_order cmd %d min %d online %d present %d possible %d cpus %d", slub_min_objects, min_objects, num_online_cpus(), num_present_cpus(), num_possible_cpus(), nr_cpu_ids); And checked with qemu-system-x86_64 -kernel bzImage -nographic -smp 4 -append "console=ttyS0" [ 0.064927] SLUB calculate_order cmd 0 min 8 online 1 present 4 possible 4 cpus 4 [ 0.064970] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 The num_online_cpus has the same behavior as on my platform and num_online_cpus = 1 when kmem_cache_init() is called Only the num_present_cpus = 4 from the beginning but that's probably just because it runs in a VM Also it's interesting to notice that num_possible_cpus and nr_cpu_ids are set to the correct value > >