Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2160930rdd; Fri, 12 Jan 2024 00:49:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHoDnXPp3x+zbRKt37+p6rVxb2ActFIZQmiNj51Qzhe3gVXWjG0DL5ieTdbsebdK+TFc5hO X-Received: by 2002:a05:6808:1492:b0:3bd:5f44:9f26 with SMTP id e18-20020a056808149200b003bd5f449f26mr857376oiw.85.1705049361366; Fri, 12 Jan 2024 00:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705049361; cv=none; d=google.com; s=arc-20160816; b=lgwHiU5lbAPqBcL50lQUlaxK5rO/hcjJEknyV0pJ+GJeqb3/ZgOUR2hFmPWu6/g6Tp nSJdiSni6E7CLKHsEVkgUCS7yOOgxECiq5vFTsYXYtieakW1JSrkvFpYzcnIQmnxlaCN EWFmGhnwtqBMS7E/o6TmU+2xrX8CtBvSggzFIbwJ02MJZa5n8VhqWZz27a53ho6ZeRn9 4p283dhgKEgzgysztwl5MJIEQDFTTyBETtpPy5W132zEZSv+zOofZAdiA6STNX0yDopV TMgvCGkzRQ6OjVJwBjjfU9tP8Zt6POWyIoj4/w2fSFnqXarAnUqf/80fOhF1PP6KhtL7 8/qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=6sXPhHbdfaX/RtWLihGxAHTWJmXovJjXqKxXGD3VnTs=; fh=YJ11Oa6QEmUx3QOFDh8WZ5FCBavLfbb/Y28kn57y+yk=; b=DOiVoWeEcRcA0zUbrknq/TjRSdW2hYKey7GOOjKG52vI3Eanh+7eNHwGY1ViMxVZtk HzUxk0kw01mylm719RjWReISElMKIMv8d47tgpf5YTysnb46Cji+2B5FGJCjlDEHW6ZA U0oWbdn0Xb3/G8rFbh1lnGXEInUYuyhgcPeI5XsMHPcrGmO0XL5ex3trC3HCTw3PBV10 lOVloOnsOPx66NB558A97V8aKh1XflESclAOCHzaTrAQuXcw1+jGqjCejyiF4seM7yGk 3AwsJh8/7TxrvlGo2hfPL4Ip9VQQwhmTl9Zq+0AXX4HChts+tzGp6c1JyFl4o9luC74F OnRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=a2slaEPw; dkim=pass header.i=@suse.com header.s=susede1 header.b=a2slaEPw; spf=pass (google.com: domain of linux-kernel+bounces-24433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24433-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bz16-20020a056a02061000b005ceb4a70475si3128902pgb.83.2024.01.12.00.49.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 00:49:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=a2slaEPw; dkim=pass header.i=@suse.com header.s=susede1 header.b=a2slaEPw; spf=pass (google.com: domain of linux-kernel+bounces-24433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24433-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 04FEA287D3D for ; Fri, 12 Jan 2024 08:49:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FDCD53E2D; Fri, 12 Jan 2024 08:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="a2slaEPw"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="a2slaEPw" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 CEF7F4F60B for ; Fri, 12 Jan 2024 08:49:11 +0000 (UTC) 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 [IPv6:2a07:de40:b281:104: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 B6DDB1FC0D; Fri, 12 Jan 2024 08:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705049349; 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=6sXPhHbdfaX/RtWLihGxAHTWJmXovJjXqKxXGD3VnTs=; b=a2slaEPwGq+FKw7AfG2vIle1EKtT8s404qlxEQBjQfvL3gHZEcaeghnerLKg5x8AkU3rJz Vm1PyHkL9g2HHo+8iiw2cvx6h5qazEm6plHwqCq8vzu1qW1kXtMGA6iUbjAkAKVuy7Fx1h RuHH8PSvsino0JhCIaRPD5G7En4OJgY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1705049349; 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=6sXPhHbdfaX/RtWLihGxAHTWJmXovJjXqKxXGD3VnTs=; b=a2slaEPwGq+FKw7AfG2vIle1EKtT8s404qlxEQBjQfvL3gHZEcaeghnerLKg5x8AkU3rJz Vm1PyHkL9g2HHo+8iiw2cvx6h5qazEm6plHwqCq8vzu1qW1kXtMGA6iUbjAkAKVuy7Fx1h RuHH8PSvsino0JhCIaRPD5G7En4OJgY= 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 92EFB13782; Fri, 12 Jan 2024 08:49:09 +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 +bTaIAX9oGXLKQAAD6G6ig (envelope-from ); Fri, 12 Jan 2024 08:49:09 +0000 Date: Fri, 12 Jan 2024 09:49:08 +0100 From: Michal Hocko To: Jianfeng Wang Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [External] : Re: [PATCH] mm, oom: Add lru_add_drain() in __oom_reap_task_mm() Message-ID: References: <20240109091511.8299-1-jianfeng.w.wang@oracle.com> <1d866f1b-94b3-43ec-8f4c-2de31b82d3d1@oracle.com> <20240111135404.609af4a26d0118c0d290f11c@linux-foundation.org> <897538a0-5ce6-484e-a9bc-4e61b3be2265@oracle.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=us-ascii Content-Disposition: inline In-Reply-To: <897538a0-5ce6-484e-a9bc-4e61b3be2265@oracle.com> Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=a2slaEPw X-Spamd-Result: default: False [-4.81 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_MED(-2.00)[suse.com:dkim]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: B6DDB1FC0D X-Spam-Level: X-Spam-Score: -4.81 X-Spam-Flag: NO On Thu 11-01-24 16:08:57, Jianfeng Wang wrote: > > > On 1/11/24 1:54 PM, Andrew Morton wrote: > > On Thu, 11 Jan 2024 10:54:45 -0800 Jianfeng Wang wrote: > > > >> > >>> Unless you can show any actual runtime effect of this patch then I think > >>> it shouldn't be merged. > >>> > >> > >> Thanks for raising your concern. > >> I'd call it a trade-off rather than "not really correct". Look at > >> unmap_region() / free_pages_and_swap_cache() written by Linus. These are in > >> favor of this pattern, which indicates that the trade-off (i.e. draining > >> local CPU or draining all CPUs or no draining at all) had been made in the > >> same way in the past. I don't have a specific runtime effect to provide, > >> except that it will free 10s kB pages immediately during OOM. You are missing an important point. Those two calls are quite different. oom_reaper unmaps memory after all the reclaim attempts have failed. That includes draining all sorts of caches on the way. Including draining LRU pcp cache (look for lru_add_drain_all in the reclaim path). > > I don't think it's necessary to run lru_add_drain() for each vma. Once > > we've done it it once, it can be skipped for additional vmas. > > > Agreed. > > > That's pretty minor because the second and successive calls will be > > cheap. But it becomes much more significant if we switch to > > lru_add_drain_all(), which sounds like what we should be doing here. > > Is it possible? > > > What do you both think of adding lru_add_drain_all() prior to the for loop? lru_add_drain_all relies on WQs. And we absolutely do not want to get oom_reaper stuck just because all the WQ is jammed. So no, this is actually actively harmful! All that being said I stand by my previous statement that this patch is not doing anything measurably useful. Prove me wrong otherwise I am against merging "just for consistency patch". Really, we should go and re-evaluate existing local lru draining callers. I wouldn't be surprised if we removed some of them. -- Michal Hocko SUSE Labs