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 6A54FC4706C for ; Fri, 12 Jan 2024 08:49:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D6BC86B009B; Fri, 12 Jan 2024 03:49:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D1B8D6B009C; Fri, 12 Jan 2024 03:49:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBC876B009D; Fri, 12 Jan 2024 03:49:14 -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 AAC406B009B for ; Fri, 12 Jan 2024 03:49:14 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 708EF1A0300 for ; Fri, 12 Jan 2024 08:49:14 +0000 (UTC) X-FDA: 81670034628.23.A37587E Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf27.hostedemail.com (Postfix) with ESMTP id E63214000F for ; Fri, 12 Jan 2024 08:49:11 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=a2slaEPw; dkim=pass header.d=suse.com header.s=susede1 header.b=a2slaEPw; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf27.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705049352; 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=6sXPhHbdfaX/RtWLihGxAHTWJmXovJjXqKxXGD3VnTs=; b=Kwymn38UIhFBs0xD5+eac7x/RJnSb67ABUN2xwLH+kIFJDGA8zArx4GA8zLU/TSLKCgj4A ILukn335nEYEGbEOQVsMIie2Nq7j7ZUCS2r4eL5onAFuYMieBIa5boWITvbAdQpaLLO62m EdTGH08MYMIg5SSMbkZi48wpbocR5iA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=a2slaEPw; dkim=pass header.d=suse.com header.s=susede1 header.b=a2slaEPw; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf27.hostedemail.com: domain of mhocko@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1705049352; a=rsa-sha256; cv=none; b=OWiyqA96pV7BGgkvtdQY4pdkxlDhCAb8CmxXBa/39EUpxvKTo1mZ8foajyI2FAKapM4Wnm 9ZZ9ZFI3hdvPTR7dVOJfr4a9f/VBRnD/gUr9hbNvGP/b4XZH2vzQSc3ymz5X4ZWpu74/+9 CVff5qCxJ8jKX3RKg2o8fjpVasEwNRg= 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <897538a0-5ce6-484e-a9bc-4e61b3be2265@oracle.com> X-Rspamd-Queue-Id: E63214000F X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: u8g9nqdh49ksbfuexoq837f3zqrc9i4d X-HE-Tag: 1705049351-214280 X-HE-Meta: U2FsdGVkX19/nj00woXqCygslw5zA1rb538/iZtqg6epihSY50RCnG1IXLWG1oYlBfEkGupC/tr5HezL32tf3BAMKWVCBm7a0uo1GpXaG+rih3Qgnkevycf5gySaAnxZSg71GG0HlHxBkl/0k7tUZiq+z8kaBZU57kS+yFoRXc/d13UkhfyLozKfLxbTkTulcuDr1rSeFUlL+YE4FhMpHgzm8H919TrQrcdFzMvjEuqe9EOZ3yiZRqMq/D7k4Ffs5lx5zXKUh0bskgAPTxUxi3Ib414dQ4TdSJ5jXhll10BqncO5BPCeT4X4D/41N3Bt3vNhIB31wJVWKLmFVZtK1MvQXJquwSoQaNsKJ8+TNgBIP+F3TqFWfyS0b+qMztD0gGAr42+8QH/QBhDtAjge/IxFNomDw064YH0CgGoozgQ1fREK+/YPkXThouLyp91aZrYbRFYEy6dU83QSSS0Dar1COj0gXnQh5s0IypuQYDWKnBPLXhM/oEHGEEmOSEK3DtXKQG/J6PIRIhRPbnDzVB6j3ljKuUek0zheJlPBQ069GVVh3sqez2/xFwH/MK3NJoTxyAZnrRy2AeZAiisA4G1nJOWoh2AZ35X21nklVuVyxeEzF7eXqfspJiLeaPJHZJqdn4XLN8idB94JAI6QRz4Oa8beGitgODnb/+QU0XPvW6xRW2S+s8VL8rxWj+wA/u+4R+bs2mWXmXgRhFBkmJrIFFQG5a6XKF3faOgPdWMt6px6nTCng9YytTzv0/JyBVecCVFDFRKAmByeZZpRnmcs+B4zbkk1Cm03eLAHtUMKKV6+/5XdncvoKsfZMeniPgA2AHXnZXwiG++exsmxtbHFAcavnj4UpYsRoaIE1SbYo6px8ypjqLPx/DYUX5rx3iZBVVaNbOHhxf8miQs4GxnoGJo25DGjx5KL55blEwrZ7eeUnFjpaFu7RdKY0TuoiUewxZLAoJwC6+Nvmdv o1dT7hWS Wa5IljGZpRZp857CTYM+xHQgU4wJ2uJj0Hl5AkpWcsoTX2VGlX2vjktpG0kV9KLCHPPGQFiyigTSXZfDZSWgiglMO4Nk1/1x2y9U1FKwShQK8majODNNVUZpilRW8b7KS5zonK/BR4AK8s4tJTcLXseUM5/kNrsHaxkmqrkhXJHG0GShpdJWan9zQ9+6sHMJd3sffgGZFGpHJHMVKVbq11SDD9MxqjKLwsK5wR0oQH8c1CMhPworIG+U1h2MBKeKSaOSwtP1fjexYjiEB4pni7vAuDz27OfQ1UhYD 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 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