Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3817764pxb; Tue, 26 Jan 2021 05:42:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyS0udw0wtXJbW/XxBsnc+gRfm7oPlG33k9YUlo/rmqOr01/2BKOAo3MZkv/QfP8ck108b X-Received: by 2002:a05:6402:438d:: with SMTP id o13mr4548932edc.135.1611668561690; Tue, 26 Jan 2021 05:42:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611668561; cv=none; d=google.com; s=arc-20160816; b=V+s32/67XxdptLRFfPyEl5f/ZaetSdIND8HAIaV4veNHAGsEMXdzmVFVnT7zhqDhb7 y34E0Djx+wQF2c4/EjR0WuYIFJqVUErJWKufeCM6SkTavxCK6J4Dx/29TaOLrebbMF0q Q04o8Q2t3uHJXqz0Tn6nVo0mszqPKR8vTi4Br6XdiHIiMjXf9iBFqDVILPbQLsGIPFtL Pu4+TXNGSK0VVPib7P8HLiZoWj5Munf/VfzbpWSWr1tJO2py59VL0cAFJGHmWsQjYsPC EA3Y6Y6mwGKqBXF6BTtxT8V4CiTh3UfITayAWttuonHX/gYJPEmyO7+QEmr66d1LPjbL qsog== 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=oZ1J3xOVFtmJXTfZDgdAErA6KmvVsDRz9fNO4jgxHtI=; b=Eyg+zeYxVkTJUMG5W8muHPPNDaN17u0Lrl00XTSBCec1FJ7cecrS/qi+yvn44+WxLr QnkODuME/a0uNKVQuQldRERwMWW6Hss/5ADAM3piFr5NybRmSKa1S+eQZRFQfgWaPWkU 01WF9rjHIJYXNIhW+QP3PKDjloRWMv/Z7dyS5WIj2rx/bBXqGoqr49JhUUYOuONUj/CL JfWd0jycHwdHFkkZExVtorMiGem+U7YscWUSiL/L7Qg7TZE0brhb9kIGUTT/RQJoAmus ClWvTDkCsu8VrrSQai8mydyN6QekPJNYL7RQ3uvEkgzJC6GnM47rlInV0ElsBamMRcZh fQ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SMgFuNiK; 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 c12si8819520edq.395.2021.01.26.05.42.08; Tue, 26 Jan 2021 05:42:41 -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=SMgFuNiK; 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 S2404768AbhAZNkW (ORCPT + 99 others); Tue, 26 Jan 2021 08:40:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391883AbhAZNjI (ORCPT ); Tue, 26 Jan 2021 08:39:08 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5FB3C0611C2 for ; Tue, 26 Jan 2021 05:38:27 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id t8so12237655ljk.10 for ; Tue, 26 Jan 2021 05:38:27 -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=oZ1J3xOVFtmJXTfZDgdAErA6KmvVsDRz9fNO4jgxHtI=; b=SMgFuNiKEiPhgaDPUI1/GdrArkuGqBjLB3McvDo7jbt34eJ2jgnjX6f9mSvR28tX6E S3n2pwarMwadMM76RXTY7ocxNTiwpwU+6q90aq30CIKjLApsgEURWwrHy39IMez6H+0t 8YsGmK3jPcbZbzVR5hcoqYvngNAyZTiNRI0T6nWv1kqYd0yr4l2JVIjvL2h7nq6P2WHG ak371TlfXR3u3bVbzRGSsYrgkqdz5YahDQzHUSd9R7N9p2sAAuxeEt6Z5D8GuH4jwi61 a4VhTxiXpiFaM9QNf3I0Uo5zp1UEBkIz0NW0JMu68F9Qw03rlXsDHjsmMYDioG8qjSAm c8ig== 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=oZ1J3xOVFtmJXTfZDgdAErA6KmvVsDRz9fNO4jgxHtI=; b=FXwmFSUiYNXuWWwssYG24rBq39UBQ11Rh0Aa6y/R4lmZqjUjZxkBStlV86M+qGzQv1 vfSPgFkaCHts8GORXasRz2SJQxNenzioRTOwsrhavHtSTswRlXYQteW4PudLM3ZbzXI+ UvfMx6Ko92A2WvEMTzYy2V1y9l46MmhlSxNdlhROYummaM1umxUAQ+eic7Vo89silwc7 eJk+rRdVl8qUDXt4y4WrQo7/vixxFlCcLrSBjjnEKfRwoBDEO1zmccaX2EyQZW2F1Dcm 663XmbeMIXJvuA9/Bx+CyDeV8UGLmtWez1vFmQIHQSByxDSXJJL8vL8asd50lOyvQlYa 6vQA== X-Gm-Message-State: AOAM531cQPgkqSPb0JQMZF+KHZmOZUuky4PoiUVsmZ4bmr2gGSRTPOWS WT335oMcacpoz0eMXGxf5TYgEGO/iWNmNt+2+jFKCg== X-Received: by 2002:a2e:5408:: with SMTP id i8mr2910097ljb.221.1611668306093; Tue, 26 Jan 2021 05:38:26 -0800 (PST) MIME-Version: 1.0 References: <20201118082759.1413056-1-bharata@linux.ibm.com> <20210121053003.GB2587010@in.ibm.com> <20210126085243.GE827@dhcp22.suse.cz> In-Reply-To: <20210126085243.GE827@dhcp22.suse.cz> From: Vincent Guittot Date: Tue, 26 Jan 2021 14:38:14 +0100 Message-ID: Subject: Re: [RFC PATCH v0] mm/slub: Let number of online CPUs determine the slub page order To: Michal Hocko Cc: Vlastimil Babka , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Jan 2021 at 09:52, Michal Hocko wrote: > > On Thu 21-01-21 19:19:21, Vlastimil Babka wrote: > [...] > > 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? > > I do agree. What is the acutal justification for this scaling? > /* > * Attempt to find best configuration for a slab. This > * works by first attempting to generate a layout with > * the best configuration and backing off gradually. > * > * First we increase the acceptable waste in a slab. Then > * we reduce the minimum objects required in a slab. > */ > > doesn't speak about CPUs. 9b2cd506e5f2 ("slub: Calculate min_objects > based on number of processors.") does talk about hackbench "This has > been shown to address the performance issues in hackbench on 16p etc." > but it doesn't give any more details to tell actually _why_ that works. > > This thread shows that this is still somehow related to performance but > the real reason is not clear. I believe we should be focusing on the > actual reasons for the performance impact than playing with some fancy > math and tuning for a benchmark on a particular machine which doesn't > work for others due to subtle initialization timing issues. > > Fundamentally why should higher number of CPUs imply the size of slab in > the first place? A 1st answer is that the activity and the number of threads involved scales with the number of CPUs. Regarding the hackbench benchmark as an example, the number of group/threads raise to a higher level on the server than on the small system which doesn't seem unreasonable. On 8 CPUs, I run hackbench with up to 16 groups which means 16*40 threads. But I raise up to 256 groups, which means 256*40 threads, on the 224 CPUs system. In fact, hackbench -g 1 (with 1 group) doesn't regress on the 224 CPUs system. The next test with 4 groups starts to regress by -7%. But the next one: hackbench -g 16 regresses by 187% (duration is almost 3 times longer). It seems reasonable to assume that the number of running threads and resources scale with the number of CPUs because we want to run more stuff. > -- > Michal Hocko > SUSE Labs