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 BB04FC352A1 for ; Wed, 7 Dec 2022 12:18:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2D768E0003; Wed, 7 Dec 2022 07:18:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ADC758E0001; Wed, 7 Dec 2022 07:18:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A3EA8E0003; Wed, 7 Dec 2022 07:18:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8B8638E0001 for ; Wed, 7 Dec 2022 07:18:22 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 484CFA0362 for ; Wed, 7 Dec 2022 12:18:22 +0000 (UTC) X-FDA: 80215412844.28.A787847 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf16.hostedemail.com (Postfix) with ESMTP id A79BD180002 for ; Wed, 7 Dec 2022 12:18:20 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=G2DeFspa; spf=pass (imf16.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670415501; a=rsa-sha256; cv=none; b=0hsId7hzWzeusB+ZZULERfUApYdzUDj7z+yNu9BMA8UpgF1uCNLpQo8gPeRIZFrEB64BaK 8GTzhbBgen+pWDYZ4CrlbCwp4asxqKKMh1sJghLSOit/baLOuWuxJTy7VTtUJa8AstJ1ty QNP6UpdbC4tzZaxXD7Zl7CTWkh0ApU0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=G2DeFspa; spf=pass (imf16.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=1670415501; 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=XsWcyBnHXfZzUpbqAQNm8GZOpQrDrOtkcxsdqceJnRU=; b=24ui3hBS4ZkqB+hAzZgLqW1xbqYGppwwjaTb3Mmca+6Nrdh2bDv3ddhgVG+IjX/k/74GYS 9jNDs83LgromkaKLN63yq85gyK/21+RrsQW9HjU3Oo6qmL6FYuqw4AOsGm25PBbVInNmR1 cv2qy11WjpJ70ap7JgWf4fNZ8nbajrc= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 31C081FDBC; Wed, 7 Dec 2022 12:18:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1670415499; 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=XsWcyBnHXfZzUpbqAQNm8GZOpQrDrOtkcxsdqceJnRU=; b=G2DeFspat7QSz2ZZ9Uz6dCgSiUH8CiIXIzc1F8JeFQxFgLL52BnuU+bdqmfIJ2/b+ZFUGM oxa9NtCDWISy7o0XuYtMG8XyoDAtNCTgsL/l9lAYtMlN7FQD5wHdoP9K3W1YRY8P0+J4Kh RDcN/EN307hE3diHYMhw2eWy75PplOg= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 14BA0136B4; Wed, 7 Dec 2022 12:18:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id /EkdAouEkGOeRwAAGKfGzw (envelope-from ); Wed, 07 Dec 2022 12:18:19 +0000 Date: Wed, 7 Dec 2022 13:18:18 +0100 From: Michal Hocko To: "Li,Rongqing" Cc: Shakeel Butt , "linux-mm@kvack.org" , "cgroups@vger.kernel.org" , "hannes@cmpxchg.org" , "roman.gushchin@linux.dev" , "songmuchun@bytedance.com" , "akpm@linux-foundation.org" Subject: Re: [PATCH] mm: memcontrol: speedup memory cgroup resize Message-ID: References: <1670240992-28563-1-git-send-email-lirongqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Spamd-Result: default: False [-0.92 / 9.00]; DMARC_POLICY_ALLOW(-0.50)[suse.com,quarantine]; R_SPF_ALLOW(-0.20)[+a:smtp-out2.suse.de]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.02)[49.84%]; RCPT_COUNT_SEVEN(0.00)[8]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[suse.com:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[] X-Rspamd-Queue-Id: A79BD180002 X-Rspamd-Server: rspam01 X-Stat-Signature: ihxrjnyutaabyucby9tfpt3b5ibsuqdw X-HE-Tag: 1670415500-572395 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 Wed 07-12-22 02:31:13, Li,Rongqing wrote: > > > > -----Original Message----- > > From: Michal Hocko > > Sent: Tuesday, December 6, 2022 6:33 PM > > To: Shakeel Butt > > Cc: Li,Rongqing ; linux-mm@kvack.org; > > cgroups@vger.kernel.org; hannes@cmpxchg.org; roman.gushchin@linux.dev; > > songmuchun@bytedance.com; akpm@linux-foundation.org > > Subject: Re: [PATCH] mm: memcontrol: speedup memory cgroup resize > > > > On Mon 05-12-22 08:32:41, Shakeel Butt wrote: > > > On Mon, Dec 5, 2022 at 3:49 AM wrote: > > > > > > > > From: Li RongQing > > > > > > > > when resize memory cgroup, avoid to free memory cgroup page one by > > > > one, and try to free needed number pages once > > > > > > > > > > It's not really one by one but SWAP_CLUSTER_MAX. Also can you share > > > some experiment results on how much this patch is improving setting > > > limits? > > > > If try to resize a cgroup to reclaim 50 Gb memory, and this cgroup has > lots of children cgroups who are reading files and alloc memory, this > patch can speed 2 or more times. Do you have any more specific numbers including a perf profile to see where the additional time is spent? I find 2 times speed up rather hard to believe. The memory reclaim itself should be more CPU heavy than additional function calls doing the same in batches. Also is this an example of a realistic usecase? > > Besides a clear performance gain you should also think about a potential over > > reclaim when the limit is reduced by a lot (there might be parallel reclaimers > > competing with the limit resize). > > > > to avoid over claim, how about to try to free half memory once? We should really focus on why would a larger batch result in a noticeably better performance. -- Michal Hocko SUSE Labs