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 C8B7BC48BC3 for ; Mon, 19 Feb 2024 19:33:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F8E76B007B; Mon, 19 Feb 2024 14:33:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3821D6B007D; Mon, 19 Feb 2024 14:33:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FB206B007E; Mon, 19 Feb 2024 14:33:22 -0500 (EST) 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 09DD46B007B for ; Mon, 19 Feb 2024 14:33:22 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C86841C043D for ; Mon, 19 Feb 2024 19:33:21 +0000 (UTC) X-FDA: 81809552202.24.B980687 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf20.hostedemail.com (Postfix) with ESMTP id 843D01C0013 for ; Mon, 19 Feb 2024 19:33:19 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=eUTltlkA; dkim=pass header.d=suse.com header.s=susede1 header.b=eUTltlkA; spf=pass (imf20.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.131 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=1708371199; a=rsa-sha256; cv=none; b=Dj4za+StpaoTrtMXUJPO/QWw+9OFp04SZopVd9jGESTkWnlQLT7PezYgx6uItf/lT1QXWm FThfOfPNbI8ioX7UxVoCBOV81WBh5dIqmDs7ynuvzAwmuZ1pNx2OGDEcufgpencmm6BKxO JZJ6RwH6HAdW8Zc6qfGzmSU6Z3Vkko4= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=eUTltlkA; dkim=pass header.d=suse.com header.s=susede1 header.b=eUTltlkA; spf=pass (imf20.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.131 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=1708371199; 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=HchPlLlQKkMnB/voXt+FYr9ksQ0f3O3AlZgGnPQ1ZbM=; b=Wmt3ZAkImQUv/4aYpOSCh0IX48FanGbMc9keuBoU5CN76IowXlpSoaVPVfxP/pcICJzzde MRq1pknfNlCbIYLCUB3O3rRrHpQsJyQmbad50vBzGgT4PMTplfulkA6x4zed5YiRAj978c RYdIeYyhq8oNPgWAXMg1/5YpMDckv2k= 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-out2.suse.de (Postfix) with ESMTPS id D3DBF1F818; Mon, 19 Feb 2024 19:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708371197; 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=HchPlLlQKkMnB/voXt+FYr9ksQ0f3O3AlZgGnPQ1ZbM=; b=eUTltlkAJEIKHb8lgQPRELfsY7gXNQbKmphlmmEagp7K+2eLe7nvcp5L86ZJEd/F3V7PEm YnDwYZqEiId8yZyb3KellQNzTCIWZL/fBXb/Mcce58uhAZEbx6tZT5IQ8XIMNFSwAsR3wq GkbakPgC1vydwLgKvn7BaByfCWoGumA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1708371197; 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=HchPlLlQKkMnB/voXt+FYr9ksQ0f3O3AlZgGnPQ1ZbM=; b=eUTltlkAJEIKHb8lgQPRELfsY7gXNQbKmphlmmEagp7K+2eLe7nvcp5L86ZJEd/F3V7PEm YnDwYZqEiId8yZyb3KellQNzTCIWZL/fBXb/Mcce58uhAZEbx6tZT5IQ8XIMNFSwAsR3wq GkbakPgC1vydwLgKvn7BaByfCWoGumA= 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 B1A4713647; Mon, 19 Feb 2024 19:33:17 +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 2KwUK/2s02UILAAAD6G6ig (envelope-from ); Mon, 19 Feb 2024 19:33:17 +0000 Date: Mon, 19 Feb 2024 20:33:17 +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: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 843D01C0013 X-Stat-Signature: ykrrgao6dckqteks8sq8bwzm95i3nsgn X-Rspam-User: X-HE-Tag: 1708371199-174168 X-HE-Meta: U2FsdGVkX1+lgfJLlbWm0K3SXX9MYFaBco5VN5LfUEXescLKwrwLK1Us9Ws5W66bMhGRD85PMCFXc/74YbKas1aLuOawrFE6skTb7XAa2FqTu9G0lmeJmDAjP61oIF4T8IvxUj+XeyvkfDfRX3xCiwvx70lXrIh2EzZNCPe4YMa0aPxcPHRlF7JfOjR5SqLmGXzvltC47QnECWFS5hj2MUeSOoWVCIqPP2omW7xE3MPh+M6zqBbB3oeA3PsMqL2BgvuV5vtaldZf3BHXIQrHtRIrWNmcH482Ao5COzNR860q26nTzN12XxSdziolXXm5CrC4fJlUbhydigzGD7aocJb/5Bm7VJlegIK0vdXFFcjBxYzgNLol4Ve18TRJeOVb5JjE1+ab8Q0/FmGZi7F94+NVsqjXEY6rUSbcMIDW344wzEvbKLeDSFkf1YxXaFNxuLGONzsgDsPyupIQR3vMjhMANt/9hi92t+4ZBmU8Vm/CGDHG213gs8QOrhzT64rAJYzdyvrQ610ApfRcCr0Be++PHk7mnD+f+bOI3YQRa8boKwydgzU7SnHpLT/b6cMzpIlazNNwiBJWcjDWxMmnhd793n1xQAuoROP7jZ330oUpx1NqqP3+mZJYm/ylZEzHKV5HvX5OXJSKe9gHP/ykJ32HX2D7hs84Eya9A72ojGOX/JBsvoxnMD1qoXgEXwHcqPEpuA5JaZoL0Hqb8TsT01ZLVRYFzWGEeyZC4h6/gkZFEy26MK4MXuMkS9SKg8ZOCJVvu8ITYa/e2wDwT61J88WUkbHOz581X6mtaKWnsrTKzpdg61HrxSmQjVGo08+daSSF6qdG3cREMFHgmlCo6zItXlVYucxgd0HwkHOaGhwbm8o5PRtF6iryx3pKuxMsttJpLadXERJ1+riiXJuhcc7K+vQsZdPKL83XnyD9Jc0xL2lG/kCY35Qf5UtNrsB7578DMpgMhnEMgdwNXxW wU6Vom8U uJd1x/XH8Ftym9X0QFy5pbK/yMFHcqaCnEcJag+RupPvxIcmWbyJD2AOa2FmNMQfFvMkx/COEvN6oP/x1Xy3u/wOg3v0IC8EnnwvTKVqr1JaxYViJAzkXNon6vSZpgz5r+kp9i2IuImzJETBVlr1AbMcWN9DA9uDQWLq/yBZzgcuawtDVB73koepvSpVTUzJW8K9nNxU2QfzMYOWSdH6tgFeVOhIx5trn8yiKBtWp5f0Dxu2ZgWxNJk3NCaBTIrC+y8alL5Vze7Oj1MkPe/YcpkHH5zJsPqRffsQiIc7kc2Sg+/NEfirT4edj5eSMFiIlRjRDxX8pHyrVcshhdfhtZitISB2rcOECKfaR0iMfoSFpKRg= 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: List-Subscribe: List-Unsubscribe: On Mon 19-02-24 08:39:19, T.J. Mercier wrote: > On Mon, Feb 19, 2024 at 4:11 AM Michal Hocko wrote: > > > > 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? > > Hi Michal, > > I updated the commit message in V4 to include a sentence about restart > cost, and added a line above each reclaim test to note the MGLRU > config and whether the memcg LRU was used or not. > > https://lore.kernel.org/all/20240206175251.3364296-1-tjmercier@google.com/ Hmm, missed that one for some reason. -- Michal Hocko SUSE Labs