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 07596C32772 for ; Tue, 23 Aug 2022 08:36:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 917566B0075; Tue, 23 Aug 2022 04:36:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C6DF8D0003; Tue, 23 Aug 2022 04:36:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78DDF8D0002; Tue, 23 Aug 2022 04:36:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 697C06B0075 for ; Tue, 23 Aug 2022 04:36:17 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 42153A0B22 for ; Tue, 23 Aug 2022 08:36:17 +0000 (UTC) X-FDA: 79830200394.19.E3A12A6 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf11.hostedemail.com (Postfix) with ESMTP id DB5824000B for ; Tue, 23 Aug 2022 08:36:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 D650D20F15; Tue, 23 Aug 2022 08:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661243775; 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=GQ02uGY4LaDgfuC0EhK53ZvKSS1XQwJHJ3fflLYmAjg=; b=cFE5YYpE9evSSKSJipAkRPfcz4A+d9gBKDJiEO/9R3S8iyIw0VuSlrAuELwxRULshwDWtf y4B7TJLPyl0RvCl65sLFFLblBcZw4v6lI0KigGg0mFZXDeVi99q3aSc7CHZw+G1jpvbDcg j9widh2Ih6uLGUegCaae2cVUgj40qRA= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C3E6713A89; Tue, 23 Aug 2022 08:36:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qJIaL3+RBGPnWQAAMHmgww (envelope-from ); Tue, 23 Aug 2022 08:36:15 +0000 Date: Tue, 23 Aug 2022 10:36:15 +0200 From: Michal Hocko To: Yu Zhao Cc: Andrew Morton , Suren Baghdasaryan , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Minchan Kim , "Kirill A . Shutemov" , Andrea Arcangeli , brauner@kernel.org, Christoph Hellwig , oleg@redhat.com, David Hildenbrand , Jann Horn , Shakeel Butt , Peter Xu , John Hubbard , shuah@kernel.org, linux-kernel , Linux-MM , linux-kselftest@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH RESEND v2 2/2] mm: delete unused MMF_OOM_VICTIM flag Message-ID: References: <20220531223100.510392-1-surenb@google.com> <20220531223100.510392-2-surenb@google.com> <20220822152119.96d40c884078229ee3e6b25e@linux-foundation.org> <20220822154822.366a9e4527b748cf99d98637@linux-foundation.org> <20220822161603.9e19edfe2daaea3bf591910a@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661243777; a=rsa-sha256; cv=none; b=bYNP2KO9m+Uxo39Zogi40i0eemOfuTgBNsJmzxoN6ynRi2xKS7xC+kSvjI8CkjlAPNWUn6 VPem4/mteJCkAkzPwQiY7sJt8aopg+Rsa/k/4BwtYNmU9Mqcwke3LZPnLF1mDop7y0G9gb R9qlQozjLwQbtP6w8NzakO4INq0eHhE= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=cFE5YYpE; spf=pass (imf11.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=1661243777; 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=GQ02uGY4LaDgfuC0EhK53ZvKSS1XQwJHJ3fflLYmAjg=; b=xk7q/uMCyyy913BebcM+ZC+qYWi5qdVcfYymsxP+8zHTymvByGN/RIco8O3Xow35ASenZ8 grAHSBWbQ0ouoGUSNDZ7MkDiDjPAQsHa6ypqEP+zOvLFHr4JvAyHvnxLmY7kVW7XP4nUXz xaVuNuY80ivrMJ3K2LQ4+yAiA286XHY= X-Stat-Signature: jtona93twocgiqxks4ie67ssa9moy7yc X-Rspamd-Queue-Id: DB5824000B X-Rspamd-Server: rspam11 X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=cFE5YYpE; spf=pass (imf11.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 X-HE-Tag: 1661243776-842827 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 Mon 22-08-22 17:20:17, Yu Zhao wrote: > On Mon, Aug 22, 2022 at 5:16 PM Andrew Morton wrote: > > > > On Mon, 22 Aug 2022 16:59:29 -0600 Yu Zhao wrote: > > > > > > > @@ -4109,7 +4109,7 @@ static int walk_pud_range(p4d_t *p4d, unsigned > > > > > long start, unsigned long end, > > > > > > > > > > walk_pmd_range(&val, addr, next, args); > > > > > > > > > > - if (mm_is_oom_victim(args->mm)) > > > > > + if (test_bit(MMF_OOM_REAP_QUEUED, &args->mm->flags)) > > > > > return 1; > > > > > > > > > > /* a racy check to curtail the waiting time */ > > > > > > > > Oh. Why? What does this change do? > > > > > > The MMF_OOM_REAP_QUEUED flag is similar to the deleted MMF_OOM_VICTIM > > > flag, but it's set at a later stage during an OOM kill. > > > > > > When either is set, the OOM reaper is probably already freeing the > > > memory of this mm_struct, or at least it's going to. So there is no > > > need to dwell on it in the reclaim path, hence not about correctness. > > > > Thanks. That sounds worthy of some code comments? > > Will do. Thanks. I would rather not see this abuse. You cannot really make any assumptions about oom_reaper and how quickly it is going to free the memory. If this is really worth it (and I have to say I doubt it) then it should be a separate patch with numbers justifying it. -- Michal Hocko SUSE Labs