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=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 F0311CA9EA0 for ; Fri, 18 Oct 2019 11:57:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AFD3220700 for ; Fri, 18 Oct 2019 11:57:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=codeblueprint-co-uk.20150623.gappssmtp.com header.i=@codeblueprint-co-uk.20150623.gappssmtp.com header.b="ztw7KsP+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFD3220700 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeblueprint.co.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 532278E0008; Fri, 18 Oct 2019 07:57:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BADB8E0003; Fri, 18 Oct 2019 07:57:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 382288E0008; Fri, 18 Oct 2019 07:57:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0108.hostedemail.com [216.40.44.108]) by kanga.kvack.org (Postfix) with ESMTP id 0D4DB8E0003 for ; Fri, 18 Oct 2019 07:57:33 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id A36C94DB8 for ; Fri, 18 Oct 2019 11:57:32 +0000 (UTC) X-FDA: 76056755544.30.honey27_7bfea6c152e4a X-HE-Tag: honey27_7bfea6c152e4a X-Filterd-Recvd-Size: 5700 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Oct 2019 11:57:31 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id p4so5947967wrm.8 for ; Fri, 18 Oct 2019 04:57:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cqKbTMZTAZ43lyW2LyE54ks+iYd/xqP3DegJ6aJ/pVg=; b=ztw7KsP+2FzSh1VwPckD1Lo4Y5c/65/19/DCxaTr9KW8Yy9cNkuNApvx1jAW5o9G7O PpSJ3q19KKK7gJ07qX1+S+s2gUSebIzk7tv6AsAOMy/RCg7pyLEub3QyFb6z+HXjkmGx 4NfFHtr8YlzqqXAB7liZv89LXbkYhNVYiRKHqQNm5k9MCaEmtiU4fnC1eKzuCqr+OxcL OzevzNiVpCfwSEYPqS6NVGlPVR2fjb65eSn90W/NO2A1t98alUTi5hSFXrE7gyO2K4nZ SuuHnrCVC7SY7AzOPPkCaCPjehjQmEb5zwmhQFxz9q6n1aC7DVH61JNWxfO9c+SM8qF7 xzEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cqKbTMZTAZ43lyW2LyE54ks+iYd/xqP3DegJ6aJ/pVg=; b=G9m+yBvghGVTYUm2Fqc+Vl/TlROBdht+icLvjzKVY0TWNMBWen+E5UAATa3ftojD8Y 2UUUIYw78qC3E27SMQqafyDC9zBNfvRGprdkYcciazxOBE0MTwgP4WxBG4cuW1W+v77g 3/j4F+adzHa2MzIFePcp7wp6QBcDwh8gSjmFtQt3Pr7yAxdyGhJsN5VEmQ2JoNTrIQVF C5+Lhcr2gA+x3YptTKO9I7TyDYBzhi6zxMalMxXQJmPnsiiIZaeHRYPVZ4+JfTnkO0BH L0s+L3UgKKQ+6fZoqbMFTK5OmrJ2cgUmB0sKpH06CoQDbEAhdl9Z0Gx85X/tnqqUzO4U n9ew== X-Gm-Message-State: APjAAAUd2bklcxEjqguXVCrPLLMBUIZhZWoACRdrfsS7SvmUaFmWOZ5d nTUL6FQbixMDitrOdl7C9HuVIw== X-Google-Smtp-Source: APXvYqyfCAk9xfZZth58XrWVeHXKOKtT2xpuI6jIbyzjLNQWiTeU6pk2f+91nr8hZ/rq0fGTLdJwxw== X-Received: by 2002:a5d:51d2:: with SMTP id n18mr7379562wrv.225.1571399849601; Fri, 18 Oct 2019 04:57:29 -0700 (PDT) Received: from localhost (97e34ace.skybroadband.com. [151.227.74.206]) by smtp.gmail.com with ESMTPSA id z9sm5211325wrp.26.2019.10.18.04.57.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Oct 2019 04:57:28 -0700 (PDT) Date: Fri, 18 Oct 2019 12:57:28 +0100 From: Matt Fleming To: Mel Gorman Cc: Andrew Morton , Michal Hocko , Vlastimil Babka , Thomas Gleixner , Borislav Petkov , Linux-MM , Linux Kernel Mailing List Subject: Re: [PATCH 2/3] mm, meminit: Recalculate pcpu batch and high limits after init completes Message-ID: <20191018115728.GF4065@codeblueprint.co.uk> References: <20191018105606.3249-1-mgorman@techsingularity.net> <20191018105606.3249-3-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191018105606.3249-3-mgorman@techsingularity.net> User-Agent: Mutt/1.5.24 (2015-08-30) 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 Fri, 18 Oct, at 11:56:05AM, Mel Gorman wrote: > Deferred memory initialisation updates zone->managed_pages during > the initialisation phase but before that finishes, the per-cpu page > allocator (pcpu) calculates the number of pages allocated/freed in > batches as well as the maximum number of pages allowed on a per-cpu list. > As zone->managed_pages is not up to date yet, the pcpu initialisation > calculates inappropriately low batch and high values. > > This increases zone lock contention quite severely in some cases with the > degree of severity depending on how many CPUs share a local zone and the > size of the zone. A private report indicated that kernel build times were > excessive with extremely high system CPU usage. A perf profile indicated > that a large chunk of time was lost on zone->lock contention. > > This patch recalculates the pcpu batch and high values after deferred > initialisation completes on each node. It was tested on a 2-socket AMD > EPYC 2 machine using a kernel compilation workload -- allmodconfig and > all available CPUs. > > mmtests configuration: config-workload-kernbench-max > Configuration was modified to build on a fresh XFS partition. > > kernbench > 5.4.0-rc3 5.4.0-rc3 > vanilla resetpcpu-v1r1 > Amean user-256 13249.50 ( 0.00%) 15928.40 * -20.22%* > Amean syst-256 14760.30 ( 0.00%) 4551.77 * 69.16%* > Amean elsp-256 162.42 ( 0.00%) 118.46 * 27.06%* > Stddev user-256 42.97 ( 0.00%) 50.83 ( -18.30%) > Stddev syst-256 336.87 ( 0.00%) 33.70 ( 90.00%) > Stddev elsp-256 2.46 ( 0.00%) 0.81 ( 67.01%) > > 5.4.0-rc3 5.4.0-rc3 > vanillaresetpcpu-v1r1 > Duration User 39766.24 47802.92 > Duration System 44298.10 13671.93 > Duration Elapsed 519.11 387.65 > > The patch reduces system CPU usage by 69.16% and total build time by > 27.06%. The variance of system CPU usage is also much reduced. > > Cc: stable@vger.kernel.org # v4.15+ > Signed-off-by: Mel Gorman > --- > mm/page_alloc.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) Tested-by: Matt Fleming