Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1620333iog; Thu, 16 Jun 2022 10:02:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uu3f1IteUfOvjuaToWeGdYI/C0WFwaxKYofNYiBRP2Ci6HlxlAf5dlvKtfN+WEXCi3MQL0 X-Received: by 2002:a63:4b02:0:b0:3fc:a31a:304 with SMTP id y2-20020a634b02000000b003fca31a0304mr5186758pga.121.1655398972184; Thu, 16 Jun 2022 10:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655398972; cv=none; d=google.com; s=arc-20160816; b=JjpfbmtaVhItFTrmrlHlzYuQk6rnmsxxpzq3syJOYQ2NZv5gzhR6uDUfmw9Va/OI8s cqctomPqQYSQP9pyt+4nZrphtD57G2dZJfBna1Dqybxf0x418jX7UzWQj3wThcl6xCYY wojwtwwiZZ3/JVHNLWgtMiT3icQJnTWE6QGWg8Tmcsrj5bJaUM4Sy3LRja9D4lzv9icq dltamWRVOTHohl6J+4wHS7ZVAi0+nDr5Et2lFYjygT/Vum6cUKjaOkBrnRE8cP2CYbHH z0inA6d4dY37IRD2ihRJ7do9BJHu78miKS5ZHoLtT+PNmC/QJYU2Zh17yBGfStSIbqF8 Bcbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=C1VoBgkGbXg4laL5bH4HWrKR+vWwEu9Z23xckivXmes=; b=eHKYpWm4L/EmBHoCnLGiY8/dz/zVVMY6GkdRoPjKlMpDtwHjKLWr4ycLAvnNtqUaMt HaWTTmRPAUD4PmnRXzL5Rj/wcL9gRKqBTFg0GYDxQRZy4MsTU3+cKs7vITb+QwQMw7Z/ fIVTVLQ+O8yO6deqPt+m40Fju71xhThZtrt7slgH8cPzUcIY/gddFkLXfWjgHf7txftz 8IC5DQnJMcG2qm7YriOL1Cc5ggivo02nO/KRrEs5h27FHT9stKFlVItg8qbLGBy6zrNL nxaGYkqzs1z+W7FQkUsblBsgUSiKd00iBUBpwdCrzsnjnBRGj12nVESFc0UU9eWVisQV MMDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=xqtDQC6j; dkim=neutral (no key) header.i=@suse.cz header.b=Jpyet56o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a63550d000000b003fc590f41fdsi3007773pgb.605.2022.06.16.10.02.31; Thu, 16 Jun 2022 10:02:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=xqtDQC6j; dkim=neutral (no key) header.i=@suse.cz header.b=Jpyet56o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236005AbiFPQls (ORCPT + 99 others); Thu, 16 Jun 2022 12:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbiFPQlr (ORCPT ); Thu, 16 Jun 2022 12:41:47 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DAED30571 for ; Thu, 16 Jun 2022 09:41:46 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 05D3B21D69; Thu, 16 Jun 2022 16:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1655397705; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C1VoBgkGbXg4laL5bH4HWrKR+vWwEu9Z23xckivXmes=; b=xqtDQC6j7j+cQrEePhj/pcb7yMcbwTGcnUwC/c/h4hG4E88F2rduqNEi29Ellay8XBooIL B9Ec8q2Acn9n/vHbap2YRi0DLOkaxFFbhO8CmftVhMT9wP/RpY99fAizx1F9yPwMoS/LK/ ClhBjwd8d+7ni5wJ9BlFhTicVax3Xx4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1655397705; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C1VoBgkGbXg4laL5bH4HWrKR+vWwEu9Z23xckivXmes=; b=Jpyet56oMoTv+WiDy5u1cSLDwAPXED/B20ff7fmHtvM/DYzob2DnUqtbtzdMGGgR0zoLAl Nqf25PzOYC+jtQAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CF8431344E; Thu, 16 Jun 2022 16:41:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Spz3MEhdq2IUXQAAMHmgww (envelope-from ); Thu, 16 Jun 2022 16:41:44 +0000 Message-ID: <4a5d90b3-afe4-7c13-b989-3ece4a797b1f@suse.cz> Date: Thu, 16 Jun 2022 18:41:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 6/7] mm/page_alloc: Remotely drain per-cpu lists Content-Language: en-US To: Mel Gorman , Andrew Morton Cc: Nicolas Saenz Julienne , Marcelo Tosatti , Michal Hocko , Hugh Dickins , LKML , Linux-MM References: <20220613125622.18628-1-mgorman@techsingularity.net> <20220613125622.18628-7-mgorman@techsingularity.net> From: Vlastimil Babka In-Reply-To: <20220613125622.18628-7-mgorman@techsingularity.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/13/22 14:56, Mel Gorman wrote: > From: Nicolas Saenz Julienne > > Some setups, notably NOHZ_FULL CPUs, are too busy to handle the per-cpu > drain work queued by __drain_all_pages(). So introduce a new mechanism to > remotely drain the per-cpu lists. It is made possible by remotely locking > 'struct per_cpu_pages' new per-cpu spinlocks. A benefit of this new > scheme is that drain operations are now migration safe. > > There was no observed performance degradation vs. the previous scheme. > Both netperf and hackbench were run in parallel to triggering the > __drain_all_pages(NULL, true) code path around ~100 times per second. The > new scheme performs a bit better (~5%), although the important point here > is there are no performance regressions vs. the previous mechanism. > Per-cpu lists draining happens only in slow paths. > > Minchan Kim tested this independently and reported; > > My workload is not NOHZ CPUs but run apps under heavy memory > pressure so they goes to direct reclaim and be stuck on > drain_all_pages until work on workqueue run. > > unit: nanosecond > max(dur) avg(dur) count(dur) > 166713013 487511.77786438033 1283 > > From traces, system encountered the drain_all_pages 1283 times and > worst case was 166ms and avg was 487us. > > The other problem was alloc_contig_range in CMA. The PCP draining > takes several hundred millisecond sometimes though there is no > memory pressure or a few of pages to be migrated out but CPU were > fully booked. > > Your patch perfectly removed those wasted time. > > Signed-off-by: Nicolas Saenz Julienne > Signed-off-by: Mel Gorman > Tested-by: Minchan Kim > Acked-by: Minchan Kim Acked-by: Vlastimil Babka