Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp790506rdg; Wed, 11 Oct 2023 05:49:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2/GfxSVaA5Uu4F1NyEWH9vhKDbhHlxTq9A3SROYSmOLk+/3lTVJ9yzNtSvBwDomKftUGg X-Received: by 2002:a05:6870:71c1:b0:1e1:300e:ee95 with SMTP id p1-20020a05687071c100b001e1300eee95mr27977718oag.45.1697028561112; Wed, 11 Oct 2023 05:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697028561; cv=none; d=google.com; s=arc-20160816; b=GkcJKbXVZS4JVaAP9etWLn7PDloCeO+dnSo15MneTP0ID4rPJ3PpDkzo8/fwPrqHZD KU9tqH/9CbTxODYy+aRnOEi65sOBVARQcUcvkokByfmYypHxjet8DdGwyYvSvvJhI/Pp bFWz02IADnuylRJim4CS96pF/TCXpoh7ErUARi/CQnmmdjX6M2kSa6eaTKwUDyjk9EMR uHmRFH73h/XM+6JfrNhZoYnGl7AdX3rIBO890T7nc8bNvJlxLk3Ugm36kaRzkNRj9hEq XYmdfnLWLplwbsoJQQNgCWB2SzuQtAlzJthyexy+R6HUT22i2sfRUsHE+VQiX/2NqLof 0vrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=GySnxjPXLl2D/+TYnAt/qOPXeURf1oxRhxBX9ZQKXvw=; fh=ukqztD1M2m5XsR/Os+/aO0Vc+vHqgDcAt7WzoiZcIPw=; b=TCPV/ag0rCukl+VP+Ewv/yrGtzPmRyghhQDED+31ZCBScNoy1kBgsjvHmT0KNssnsX KNL3x7HPLV2PtUQRjpXNfddL255k69X06t3TNWWsRpshTiulJ7Jk3UTklYsRen6CLF3L Z/WZObQC6V2+6MEGk/dk1I48OMRAYSBKAZfxF34y4/CyJBfQ+WWw/b0CoowU1pUTq/t+ vhCtnDKMpOpQMvL43CkYcyvodLILHcBpkbaXfeu9lClk6GFcjq0ow004t+2B8vWp0zHw N7ZsZvlTpPUW7c3YaEKMyP8VEL7vi6W3SenuAqYWBURWM4/shNfT5pDq/BUB/sWdwg4+ dy1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id l186-20020a6388c3000000b00584ba113ec5si14288952pgd.370.2023.10.11.05.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 05:49:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 874D9807D9A4; Wed, 11 Oct 2023 05:49:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbjJKMtH (ORCPT + 99 others); Wed, 11 Oct 2023 08:49:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231262AbjJKMtG (ORCPT ); Wed, 11 Oct 2023 08:49:06 -0400 Received: from outbound-smtp02.blacknight.com (outbound-smtp02.blacknight.com [81.17.249.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA9992 for ; Wed, 11 Oct 2023 05:49:03 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp02.blacknight.com (Postfix) with ESMTPS id 69D69BAD2C for ; Wed, 11 Oct 2023 13:49:02 +0100 (IST) Received: (qmail 12957 invoked from network); 11 Oct 2023 12:49:02 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.197.19]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 11 Oct 2023 12:49:02 -0000 Date: Wed, 11 Oct 2023 13:49:00 +0100 From: Mel Gorman To: Huang Ying Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Arjan Van De Ven , Andrew Morton , Vlastimil Babka , David Hildenbrand , Johannes Weiner , Dave Hansen , Michal Hocko , Pavel Tatashin , Matthew Wilcox , Christoph Lameter Subject: Re: [PATCH 03/10] mm, pcp: reduce lock contention for draining high-order pages Message-ID: <20231011124900.sp22hoxoitrslbia@techsingularity.net> References: <20230920061856.257597-1-ying.huang@intel.com> <20230920061856.257597-4-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20230920061856.257597-4-ying.huang@intel.com> X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 05:49:18 -0700 (PDT) X-Spam-Level: ** On Wed, Sep 20, 2023 at 02:18:49PM +0800, Huang Ying wrote: > In commit f26b3fa04611 ("mm/page_alloc: limit number of high-order > pages on PCP during bulk free"), the PCP (Per-CPU Pageset) will be > drained when PCP is mostly used for high-order pages freeing to > improve the cache-hot pages reusing between page allocating and > freeing CPUs. > > On system with small per-CPU data cache, pages shouldn't be cached > before draining to guarantee cache-hot. But on a system with large > per-CPU data cache, more pages can be cached before draining to reduce > zone lock contention. > > So, in this patch, instead of draining without any caching, "batch" > pages will be cached in PCP before draining if the per-CPU data cache > size is more than "4 * batch". > > On a 2-socket Intel server with 128 logical CPU, with the patch, the > network bandwidth of the UNIX (AF_UNIX) test case of lmbench test > suite with 16-pair processes increase 72.2%. The cycles% of the > spinlock contention (mostly for zone lock) decreases from 45.8% to > 21.2%. The number of PCP draining for high order pages > freeing (free_high) decreases 89.8%. The cache miss rate keeps 0.3%. > > Signed-off-by: "Huang, Ying" Acked-by: Mel Gorman However, the flag should also have been documented to make it clear that it preserves some pages on the PCP if the cache is large enough. Similar to the previous patch, it would have been easier to reason about in the general case if the decision had only been based on the LLC without having to worry if any intermediate layer has a meaningful impact that varies across CPU implementations. -- Mel Gorman SUSE Labs