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 52851EE49A5 for ; Mon, 21 Aug 2023 09:27:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A74018D0009; Mon, 21 Aug 2023 05:27:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A22C78D0001; Mon, 21 Aug 2023 05:27:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9117C8D0009; Mon, 21 Aug 2023 05:27:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8208C8D0001 for ; Mon, 21 Aug 2023 05:27:43 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 43A28B2230 for ; Mon, 21 Aug 2023 09:27:43 +0000 (UTC) X-FDA: 81147584406.06.6A8AFEB Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf19.hostedemail.com (Postfix) with ESMTP id 3B0971A0006 for ; Mon, 21 Aug 2023 09:27:41 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=sEUNJZ8f; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692610061; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rasP87Ht2gj5lNq3XecgO8n8VINxTXXwjlC6bZtC8Vo=; b=ahul/gGwaxQfalUe1cJCCefOXeK5B5QdncipMeK0GSXCwHfq4iSIqhtMpQid0jaHboQaxd 6zOLA2cadVkZd4xdF4S+/Dt8KybTnyI+sRBWQrJYm6L7mszuO3Jng89Toeg4hPw9vAgBGR U5bob6m85nzutxr1dmeFGBvgVY/8Bxk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692610061; a=rsa-sha256; cv=none; b=FjR1ceiUducAP9EI3J+rGj9wloypjAsmJ97MrqMU3+NbaE4qV9pLUlbx/E4/+5lK4/5fos DtYO1S/aneNmaOoirOyseCPNm1A8yFzbdWVSrRceafsA/QFg+jwaUukC4+nR0FMyLv+5mq Pjd+SvBF9tNc57Z+vJfDSgL4yt6SbQA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=sEUNJZ8f; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com 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-out2.suse.de (Postfix) with ESMTPS id 194B9205DF; Mon, 21 Aug 2023 09:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1692610059; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rasP87Ht2gj5lNq3XecgO8n8VINxTXXwjlC6bZtC8Vo=; b=sEUNJZ8fTGnLp3khwGCYXfLrC2wutjm+aRHAOfo1QsBDF56tB9oBXefPoFXZeyy4AuRXUI B3DX8XAeCDYD943WD1wHsEH0Jr1fEBrLWFrhxrhgJDJC0Bw+r6HWejIBuf/0KzVe0f3oOD n3k5kspkmcJfoP3gM2vrXahZpsX3Htk= 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 EE3F91330D; Mon, 21 Aug 2023 09:27:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VvpKOQou42TNXAAAMHmgww (envelope-from ); Mon, 21 Aug 2023 09:27:38 +0000 Date: Mon, 21 Aug 2023 11:27:38 +0200 From: Michal Hocko To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , Mel Gorman , Vlastimil Babka Subject: Re: [PATCH] mm: fix draining remote pageset Message-ID: References: <20230811090819.60845-1-ying.huang@intel.com> <87r0o6bcyw.fsf@yhuang6-desk2.ccr.corp.intel.com> <87jztv79co.fsf@yhuang6-desk2.ccr.corp.intel.com> <87v8d8dch1.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87v8d8dch1.fsf@yhuang6-desk2.ccr.corp.intel.com> X-Rspamd-Queue-Id: 3B0971A0006 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 8s7juzm4eph8iaea9f635o8n9mi3i3ym X-HE-Tag: 1692610060-972952 X-HE-Meta: U2FsdGVkX18erbdHX84SG6/kcPnKma+806uMbSvaelzmaJ1Uvozf0lRFhOVZYFvPDow/yiBs7g9y1UWQdU9WW8DJdanv5mRiWds46iUBFvDZDwVt0mr/SLu1G6kfP2FTXH0dVeP/hk6Z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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 Mon 21-08-23 16:30:18, Huang, Ying wrote: > Michal Hocko writes: > > > On Wed 16-08-23 15:08:23, Huang, Ying wrote: > >> Michal Hocko writes: > >> > >> > On Mon 14-08-23 09:59:51, Huang, Ying wrote: > >> >> Hi, Michal, > >> >> > >> >> Michal Hocko writes: > >> >> > >> >> > On Fri 11-08-23 17:08:19, Huang Ying wrote: > >> >> >> If there is no memory allocation/freeing in the remote pageset after > >> >> >> some time (3 seconds for now), the remote pageset will be drained to > >> >> >> avoid memory wastage. > >> >> >> > >> >> >> But in the current implementation, vmstat updater worker may not be > >> >> >> re-queued when we are waiting for the timeout (pcp->expire != 0) if > >> >> >> there are no vmstat changes, for example, when CPU goes idle. > >> >> > > >> >> > Why is that a problem? > >> >> > >> >> The pages of the remote zone may be kept in the local per-CPU pageset > >> >> for long time as long as there's no page allocation/freeing on the > >> >> logical CPU. In addition to the logical CPU goes idle, this is also > >> >> possible if the logical CPU is busy in the user space. > >> > > >> > But why is this a problem? Is the scale of the problem sufficient to > >> > trigger out of memory situations or be otherwise harmful? > >> > >> This may trigger premature page reclaiming. The pages in the PCP of the > >> remote zone would have been freed to satisfy the page allocation for the > >> remote zone to avoid page reclaiming. It's highly possible that the > >> local CPU just allocate/free from/to the remote zone temporarily. > > > > I am slightly confused here but I suspect by zone you mean remote pcp. > > But more importantly is this a concern seen in real workload? Can you > > quantify it in some manner? E.g. with this patch we have X more kswapd > > scanning or even hit direct reclaim much less often. > >> So, > >> we should free PCP pages of the remote zone if there is no page > >> allocation/freeing from/to the remote zone for 3 seconds. > > > > Well, I would argue this depends a lot. There are workloads which really > > like to have CPUs idle and yet they would like to benefit from the > > allocator fast path after that CPU goes out of idle because idling is > > their power saving opportunity while workloads want to act quickly after > > there is something to run. > > > > That being said, we really need some numbers (ideally from real world) > > that proves this is not just a theoretical concern. > > The behavior to drain the PCP of the remote zone (that is, remote PCP) > was introduced in commit 4ae7c03943fc ("[PATCH] Periodically drain non > local pagesets"). The goal of draining was well documented in the > change log. IIUC, some of your questions can be answered there? > > This patch just restores the original behavior changed by commit > 7cc36bbddde5 ("vmstat: on-demand vmstat workers V8"). Let me repeat. You need some numbers to show this is needed. -- Michal Hocko SUSE Labs