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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99F2BC43334 for ; Thu, 16 Jun 2022 16:41:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D8A66B0074; Thu, 16 Jun 2022 12:41:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 360B96B0075; Thu, 16 Jun 2022 12:41:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B45C6B0078; Thu, 16 Jun 2022 12:41:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0A7E66B0074 for ; Thu, 16 Jun 2022 12:41:47 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id CC863121079 for ; Thu, 16 Jun 2022 16:41:46 +0000 (UTC) X-FDA: 79584665412.25.E65A5E6 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf06.hostedemail.com (Postfix) with ESMTP id 64607180047 for ; Thu, 16 Jun 2022 16:41:46 +0000 (UTC) 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655397706; a=rsa-sha256; cv=none; b=2iPesUlDZa9WgLQ6zLfcu07DmENucM3ucEBBXqdsMmW35G4x4utSb3bRHh4aX7mYiRmYBO I+hrZzSquKdoi732zLyIJG6TgrFhtX1euy6+bYbnc63UeUApf+uz6SM//dBdHNLW4/5z+C Le+GkQ72JS5r0TgjFK9Iso5SXkizufs= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=xqtDQC6j; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=Jpyet56o; spf=pass (imf06.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655397706; h=from:from:sender:reply-to:subject:subject: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:dkim-signature; bh=C1VoBgkGbXg4laL5bH4HWrKR+vWwEu9Z23xckivXmes=; b=qYTZvhMm2wfDAgQYp37Z00f9bspPjlEVZedujnJcrhy5dC15xgtzCcV7UdBNFMBZaKCGeF BInC+Hbfd3aUL6Qo8Y8mNLTYKfLATjWoiuPolQKJ/UCkRNjp0wKuCoHwGX4I5nRhXMVxAQ hytrqs3dFqdZ6fA16vgvViGIuyt3sNQ= X-Stat-Signature: ix4za8bofs531fzcfohz5gm8p8f81tor X-Rspamd-Queue-Id: 64607180047 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=xqtDQC6j; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=Jpyet56o; spf=pass (imf06.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1655397706-408471 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 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