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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 BC9F2C433E6 for ; Tue, 19 Jan 2021 19:10:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 002C520776 for ; Tue, 19 Jan 2021 19:10:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 002C520776 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B5C336B0010; Tue, 19 Jan 2021 12:00:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE5A06B0012; Tue, 19 Jan 2021 12:00:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AE146B0022; Tue, 19 Jan 2021 12:00:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 7C1FB6B0010 for ; Tue, 19 Jan 2021 12:00:46 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 36AB6824999B for ; Tue, 19 Jan 2021 17:00:46 +0000 (UTC) X-FDA: 77723138892.27.story70_12147a027553 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 21BA53D677 for ; Tue, 19 Jan 2021 17:00:43 +0000 (UTC) X-HE-Tag: story70_12147a027553 X-Filterd-Recvd-Size: 5655 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 17:00:41 +0000 (UTC) Received: by mail-qt1-f175.google.com with SMTP id r9so14181882qtp.11 for ; Tue, 19 Jan 2021 09:00:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=08oR5ePKYgmnwUMmiLW3tz0XD53PWw3uZbGRzawOCH0=; b=1e/gcV+jAqcthVzHr6yKibOb206aNyj01G2lTxdMnairjICxqUb7F+ykvckU6iJog7 UODCTD0bHtjP/kM1+lkgOj8S5/6RX8zAd4RonEcGObwVXpvQwlnZmF8aLytmC5HFbnvl EtlYSZLyVuwEmN2T8kaPEnh9WlP8Qn7G+sUisFmHnzqLjly+Qn0ccs3DrKqsZQB87V5B TGcWng2PQNs9y7c0CelsY9hO1Xp+/znVgXw0zyvcRgh5bB8u69uJbpEIAv8hJix3wPdN QS6W+m7GyPt4qBCIXvbTSxc/0c1jWx1ie7p4nI8X5Pwda8GQEqX1T44ub0lRoo/V4I2v QCaQ== 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:content-transfer-encoding :in-reply-to; bh=08oR5ePKYgmnwUMmiLW3tz0XD53PWw3uZbGRzawOCH0=; b=YzmflKRZPEOsXSTkMUuRfTwfva9t2BlwiRFyVVNkT/nWoIh2lBBEy1Na15pU+cXsVC c/6YOyCVaOZ9kn+icWg5Gf67rZUB67L5rgU+/nIbi3CSQV8aRzaRujNlArOTnfev2j55 a0s2SMmXg8f7Pl/4J1f1jUPxYSgu5oY0I3QAy2D3CnwfgZjDYZw509571Zx63GhO5FDo K1xIcx1FIS690JwJLBnYNvTIw9ODubCfpCXipl/SCkJ6rSw2e0VtogkPJC/J8yswonYi OXhJEj3yP8P796kEs/BtxDyiP5CK8cPMSGpZ/SwGydatkTbJwfHDrvmr4B/oC6+QwYYd gUnw== X-Gm-Message-State: AOAM533BDCY3XlSspg74fGS8tkmb+Ie/qbpdJMGa4FbsIbq58z3iAZei dEcGCx7AHCw3kSol/prBaIsqdw== X-Google-Smtp-Source: ABdhPJwG5qVDddc/+jIaMXA2P/4YTTV/Di5QpmE94tL/+G9HhfuYNS7pUAsadGjLuyfZVH76fZrwug== X-Received: by 2002:ac8:bc4:: with SMTP id p4mr5027979qti.195.1611075640557; Tue, 19 Jan 2021 09:00:40 -0800 (PST) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id z26sm13255427qki.40.2021.01.19.09.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 09:00:39 -0800 (PST) Date: Tue, 19 Jan 2021 12:00:38 -0500 From: Johannes Weiner To: Feng Tang Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm: page_counter: relayout structure to reduce false sharing Message-ID: References: <1611040814-33449-1-git-send-email-feng.tang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1611040814-33449-1-git-send-email-feng.tang@intel.com> 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 Tue, Jan 19, 2021 at 03:20:14PM +0800, Feng Tang wrote: > When checking a memory cgroup related performance regression [1], > from the perf c2c profiling data, we found high false sharing for > accessing 'usage' and 'parent'. >=20 > On 64 bit system, the 'usage' and 'parent' are close to each other, > and easy to be in one cacheline (for cacheline size =3D=3D 64+ B). 'usa= ge' > is usally written, while 'parent' is usually read as the cgroup's > hierarchical counting nature. >=20 > So move the 'parent' to the end of the structure to make sure they > are in different cache lines. >=20 > Following are some performance data with the patch, against > v5.11-rc1. [ In the data, A means a platform with 2 sockets 48C/96T, > B is a platform of 4 sockests 72C/144T, and if a %stddev will be > shown bigger than 2%, P100/P50 means number of test tasks equals > to 100%/50% of nr_cpu] >=20 > will-it-scale/malloc1 > --------------------- > v5.11-rc1 v5.11-rc1+patch >=20 > A-P100 15782 =B1 2% -0.1% 15765 =B1 3% will-it-scale.= per_process_ops > A-P50 21511 +8.9% 23432 will-it-scale.per_p= rocess_ops > B-P100 9155 +2.2% 9357 will-it-scale.per_= process_ops > B-P50 10967 +7.1% 11751 =B1 2% will-it-scale.per= _process_ops >=20 > will-it-scale/pagefault2 > ------------------------ > v5.11-rc1 v5.11-rc1+patch >=20 > A-P100 79028 +3.0% 81411 will-it-scale.per_= process_ops > A-P50 183960 =B1 2% +4.4% 192078 =B1 2% will-it-scale.p= er_process_ops > B-P100 85966 +9.9% 94467 =B1 3% will-it-scale.pe= r_process_ops > B-P50 198195 +9.8% 217526 will-it-scale.per_p= rocess_ops >=20 > fio (4k/1M is block size) > ------------------------- > v5.11-rc1 v5.11-rc1+patch >=20 > A-P50-r-4k 16881 =B1 2% +1.2% 17081 =B1 2% fio.read_bw_M= Bps > A-P50-w-4k 3931 +4.5% 4111 =B1 2% fio.write_bw_MB= ps > A-P50-r-1M 15178 -0.2% 15154 fio.read_bw_MBps > A-P50-w-1M 3924 +0.1% 3929 fio.write_bw_MBps >=20 > [1].https://lore.kernel.org/lkml/20201102091543.GM31092@shao2-debian/ > Signed-off-by: Feng Tang > Reviewed-by: Roman Gushchin > Cc: Johannes Weiner > Cc: Michal Hocko Acked-by: Johannes Weiner Thanks!