Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1097384rdb; Mon, 19 Feb 2024 04:22:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVwh1LFrXB0qWOsVEcy9uWIlwb/8dc8SgQBcKjB428l0QE6hNRY2Qj5EqrUaBI+H3EKoBYfS9YygR2USzA3tLaU8i8cm09RFG7DEII46A== X-Google-Smtp-Source: AGHT+IFCOCk1fQqYa+wCc2JhXfsBu412CSmLmtBFL6quj5zwuGRPrM0VsRoFzCjM+PdTv2ZvC+EX X-Received: by 2002:a05:6a00:22c3:b0:6e4:5f8b:8fad with SMTP id f3-20020a056a0022c300b006e45f8b8fadmr3107002pfj.7.1708345328396; Mon, 19 Feb 2024 04:22:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708345328; cv=pass; d=google.com; s=arc-20160816; b=iOiNSVZYIz3nz4JSbK8JaEd2fdqEqOzGRHy8zzFo6TD2jODPwolgtXJbI6zyrrV9Fr 3fk+iXR9T+53BwLiA+kIi4v3vtE2sMijHIuxiS73p6GcKVWIkqjWCLNAkwuSSV64iD9d EWysTsHlxH9RWSXsVHVPFs41aU/lxj0uDceLx09RlikJj/yIfznPXE30bHjZJVtJdWPJ 5fh+j6wSAaDQ3qoC1zMxjiL0aCzAPzaTY9wZrVCGceyfwmUhrdV1Fjng1ujuH6UpuWSs 1+EqKmlnXWbE87KAL8Es+1NxOC2oOKtPVGidq6UaRsji0vmaV3d1EkVHotwqRUeQSpbL ixMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=dgEdE8pMlMrPDPVr2iZZlKCQOw1qxLHW5eescT7bZpg=; fh=FLnu+9e9G0INq7CrEzfnigXviGskN6NbwH5Sa8Z1NKw=; b=uZZTYfSQhLPz3s75d6IW9Mef2c7SwWU5FVB0cX/sDAufbmL9bFl1Lifs3Zoska3Ppd 3Chyz+8+g2jghiY9ZAFIyQBI7AZCMX08r04VvaJUfsq0w9lAHeHLTEmRnjyulP70qo7U 3XY4NLR2Z1uMI6PsvJot8XAhV6aSOgrSqLVfgvhK4p1PP2oqfbh6NZ19B57A3JXMoVop +ykLmHPmgCzoU3isAOBHmXORVI1C2gAmtn9ibtO1U7NGo51nEZVDZGoPLAcSADm35TGu 0k+CkkM1pNvK0VpZtCtNNAhe1Vv9tq+guy2go2QMkGpb2vhgnPoM30eK0sPt9g5KBZJb BZiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=mUO1CBBR; dkim=pass header.i=@suse.com header.s=susede1 header.b=mUO1CBBR; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-71283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71283-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id fc23-20020a056a002e1700b006e0735501c5si4442668pfb.316.2024.02.19.04.22.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 04:22:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=mUO1CBBR; dkim=pass header.i=@suse.com header.s=susede1 header.b=mUO1CBBR; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-71283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71283-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 92039B20E64 for ; Mon, 19 Feb 2024 12:11:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF1A62D606; Mon, 19 Feb 2024 12:11:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="mUO1CBBR"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="mUO1CBBR" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BF9422F00; Mon, 19 Feb 2024 12:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708344694; cv=none; b=Z8iqH472kc7YRFZtrL2KpPeQCp9qJwKIcbQCeu+xLOQ4YCgVwJueRX3LkV77nHkKnbAfNXXXl0uxbrQpKjPuuf1lpGrOkNMpBJF4q6iAew69W9JdkCsegTDD33fZ27XoIHi1mu9pnVLYgIiKIRi5EMCBLmlnxG0t85eKX9AGZJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708344694; c=relaxed/simple; bh=RKA1FRCk3ma0tGwU4yw6balfgkgpjYcTeV2wBsGPWa4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NWUaSaBbTykyJSPzsU1BoQBOMlUElfIC3IBnYsWIM5svkYpQDMCGjqSM/Z2OF/LWTmIvDr7In98S1YnwfI8qO6zHCZy123rnsg+NOW/G0nnYnmWJ/U8LHDOEkvwqkQUlJziRvLB8K1zkgbGCPMh+fM4d9T+WSUIXYy5a83OYtjI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=mUO1CBBR; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=mUO1CBBR; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4FF2D21E6D; Mon, 19 Feb 2024 12:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708344691; 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=dgEdE8pMlMrPDPVr2iZZlKCQOw1qxLHW5eescT7bZpg=; b=mUO1CBBRL3HyVHI2fWsDkW0cA/NpbcKxhZPLTjpUVNrn15DI+P6p0SBpC+BjTfClxVqY0b OaH+WJkFMGCOaI61UFckLXxAN8SE5Scv8tLSCP8ULatZb7VSAdEIYQ+DrchMsOBFiUy5Y/ PI26M9CvjSnmzPnmFtQNRxvkYXhGDu8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708344691; 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=dgEdE8pMlMrPDPVr2iZZlKCQOw1qxLHW5eescT7bZpg=; b=mUO1CBBRL3HyVHI2fWsDkW0cA/NpbcKxhZPLTjpUVNrn15DI+P6p0SBpC+BjTfClxVqY0b OaH+WJkFMGCOaI61UFckLXxAN8SE5Scv8tLSCP8ULatZb7VSAdEIYQ+DrchMsOBFiUy5Y/ PI26M9CvjSnmzPnmFtQNRxvkYXhGDu8= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2C8FB139D0; Mon, 19 Feb 2024 12:11:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id /jviB3NF02VWPgAAD6G6ig (envelope-from ); Mon, 19 Feb 2024 12:11:31 +0000 Date: Mon, 19 Feb 2024 13:11:26 +0100 From: Michal Hocko To: "T.J. Mercier" Cc: Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Efly Young , android-mm@google.com, yuzhao@google.com, mkoutny@suse.com, Yosry Ahmed , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] mm: memcg: Use larger batches for proactive reclaim Message-ID: References: <20240202233855.1236422-1-tjmercier@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -3.80 X-Spamd-Result: default: False [-3.80 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_TWELVE(0.00)[14]; FUZZY_BLOCKED(0.00)[rspamd.com]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO On Tue 06-02-24 09:58:41, Michal Hocko wrote: > On Mon 05-02-24 20:01:40, T.J. Mercier wrote: > > On Mon, Feb 5, 2024 at 1:16 PM Michal Hocko wrote: > > > > > > On Mon 05-02-24 12:47:47, T.J. Mercier wrote: > > > > On Mon, Feb 5, 2024 at 12:36 PM Michal Hocko wrote: > > > [...] > > > > > This of something like > > > > > timeout $TIMEOUT echo $TARGET > $MEMCG_PATH/memory.reclaim > > > > > where timeout acts as a stop gap if the reclaim cannot finish in > > > > > TIMEOUT. > > > > > > > > Yeah I get the desired behavior, but using sc->nr_reclaimed to achieve > > > > it is what's bothering me. > > > > > > I am not really happy about this subtlety. If we have a better way then > > > let's do it. Better in its own patch, though. > > > > > > > It's already wired up that way though, so if you want to make this > > > > change now then I can try to test for the difference using really > > > > large reclaim targets. > > > > > > Yes, please. If you want it a separate patch then no objection from me > > > of course. If you do no like the nr_to_reclaim bailout then maybe we can > > > go with a simple break out flag in scan_control. > > > > > > Thanks! > > > > It's a bit difficult to test under the too_many_isolated check, so I > > moved the fatal_signal_pending check outside and tried with that. > > Performing full reclaim on the /uid_0 cgroup with a 250ms delay before > > SIGKILL, I got an average of 16ms better latency with > > sc->nr_to_reclaim across 20 runs ignoring one 1s outlier with > > SWAP_CLUSTER_MAX. > > This will obviously scale with the number of memcgs in the hierarchy but > you are right that too_many_isolated makes the whole fatal_signal_pending > check rather inefficient. I haven't missed that. The reclaim path is > rather convoluted so this will likely be more complex than I > anticipated. I will think about that some more. > > In order to not delay your patch, please repost with suggested updates > to the changelog. This needs addressing IMO but I do not think this is > critical at this stage. Has there been a new version or a proposal to refine the changelog posted? -- Michal Hocko SUSE Labs