From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99E67606A322 for ; Thu, 3 Dec 2026 18:11:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=Nvv7SJxs Received: by kanga.kvack.org (Postfix) id 7B4566B05B1; Thu, 3 Dec 2026 13:11:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 73DF56B05B3; Thu, 3 Dec 2026 13:11:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 606526B05B4; Thu, 3 Dec 2026 13:11:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3995C6B05B1 for ; Thu, 3 Dec 2026 13:11:45 -0500 (EST) Received: from smtpin03.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C7BD21607E6 for ; Thu, 3 Dec 2026 18:11:44 +0000 (UTC) X-FDA: 85503464928.03.C5F0942 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by imf25.hostedemail.com (Postfix) with ESMTP id A78FAA001A for ; Thu, 3 Dec 2026 18:11:42 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=Nvv7SJxs; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf25.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796321503; b=PYJlADKiw0+2oxtgPWglFyP+08DWYo1Y4or2014pfHzSWf9+3z4CyDEe7ew4/ooNvtY8Eb TP8gygfNzKzSPh4zAq5WYBR1bYv1jVzZDuQceRdRwGKU2hOuoTC7ItKnJUQj8MJTBl0gFb 2UpZyK1J8PvgpzurXu/+kfGRZPnQ/Ec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796321503; 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=D6HX7hcBzGg8lNT92wfwkQoPti1WWhPyjlWz81oIyt8=; b=FRUM0mjtCfcGk//t4OPp2iBsIxw5zTGh0lxTh1XljYC46k2d6vgIiUSCJeA+J5+G7OQz6z 36edVHDNb8G+FPIatThYKQU3O3uljimxEdnSsh5gMOt63qBdqTCN1yGjZcipghJZepeD2f +A7WceDykyHsipzt6Y50xX7WF1WWyDk= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=Nvv7SJxs; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf25.hostedemail.com: domain of mhocko@suse.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=mhocko@suse.com Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4bb64ef5a00so232575e9.3 for ; Thu, 03 Dec 2026 10:11:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1796321501; x=1796926301; darn=kvack.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=D6HX7hcBzGg8lNT92wfwkQoPti1WWhPyjlWz81oIyt8=; b=Nvv7SJxscKdB2CnI50NcanvHZ3WQY6Q0nzpXhcqyqofBariqCC567Y1Lyfa6WOjryx QBBjS+cJpSiBYHxANJ6y2LwxPQaHU61+qSyVC+H0AkGMoJGF8tYBB0536xqvIMTKrz0z oYIk21kSKNYiCj+HgeO22YSKg6Ta8JL58vGoTqK0KOdKnNFR+/oGGZp8bL9ZW5gRG2+/ Nb6f1ArkFdiNf0DADsINNb/56T/y+3i6KzPBAysyduPAlDu5VFIETP7YaV6OIlb6vBks rj3ZEIo7bxX9NtMcyETK4OH9SV/srREHfZmg9hjX/0Yy1JyxVmIvv6ofNpuvzLyDHBKm rNgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796321501; x=1796926301; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=D6HX7hcBzGg8lNT92wfwkQoPti1WWhPyjlWz81oIyt8=; b=zN+YbSHgVMja3tWO4upZx6juqIjgmn7r7vmh0nFmQoC4zE8mc/8fMqfQRyBe1TRVDp +Mna24KsFzSYJ1KiYmaGCZibkllQUZZs3j1PalfkFZDV0J0VZGz0ZY77bV4tMxJPfZgG UbAr1SvmcTqTY5vm2L/1iOZsQCbctdODcB7gxbd/xvk3PnzQ4esuA3/FqNTD1n3akb1P Ru32MKsOiu8tiY1csS8wRn1t3K5KD4OAcBokiJhxYJDkQ4iR4wJP6/YDPJWcA1gsuFF/ Y8cGIUocMEPfqiYg+Wxl2Bg5NbuXFph+E6y65MJGsy34uE+lRDOn7mPsMr0IPGwjx0Sh bfZw== X-Forwarded-Encrypted: i=1; AL+hErEruc84yOApEwbtIjCtKu2RG2mtH9zlWFFunYeVs+/iaSM/7u0TjQN1R+pr8s5xDtLruS8KYHegyg==@kvack.org X-Gm-Message-State: APuU4Z8vx96oroz1+q1fXY0QjmRSod+8+ie6OP2rCw3ZI1t2rXQM1Puo nvMfyGsUtB1gEYZalOEb4qLdMS3JJph74zm5H85nbKPyY/81Ox+8JpJcI6OoUXcEfYI= X-Gm-Gg: AZFdTZdVd6BUZ0Lri5FHTnAFPFe9tNtnLPHKRBKolsQz3dd7PKIAdt5AIim+gkIci0P o/1hRtx4iZ6pgsyv9vnBdk98pj60yeda9iouK56bHqKsbreRAdiLU6gW7q+ZBA0MIrKryDD3Bnw AfS08jl0SZ6ZpLepwtNNB72AZ3xHDqOxa0oL4wzguht41mYJ1++lBdHd3cEKPqK021sPZl9NZvV 02B/Yc/mxoP4N42aJcQDtFKJE42QHft9OYQMzIWJkN0Qj+cQ1ZX1Bo0OvNOXQw6NX6pgb/ufksk SW41jKg2fNHpOn7fj5YDR9l8bFg6kE8Y7CXEWp/yEHHYcqSexam3HbqGKZAitKoR3Lho2ECXI2R oa5b93l2PI5NzxM75aGhrfkETYMzgEqNOxR3K7MExTjjo8uhl3fYOiNA84Nx2u82ptGvEFz5r+Y smY0WYKBQhyd7syFlXIoJtcbpNKuK8KObaiJDD0FlESfjtnKO9cW644IyRXOzdZ1Oz9e1sqOu6K 8dgeykCmekMiBKB1T82htI3G0VYXiZR1Ol5DjiT51zzc5v5idn+W9N+AN9zUkC4aBE2TkiW2H5o cHWZz3yKw/NQfvZ/hiFvKX3WYHuCBb8n5jfW/LfvzA== X-Received: by 2002:a05:600c:848d:b0:4bb:52d8:73ef with SMTP id 5b1f17b1804b1-4bb88940f1bmr864714485e9.34.1796321501058; Thu, 03 Dec 2026 10:11:41 -0800 (PST) Received: from localhost (109-81-27-207.rct.o2.cz. [109.81.27.207]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bba3d3679bsm319539855e9.2.2026.12.03.10.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 10:11:40 -0800 (PST) Date: Thu, 3 Dec 2026 19:11:39 +0100 From: Michal Hocko To: "Paul E. McKenney" Cc: "Lorenzo Stoakes (ARM)" , David Hildenbrand , Andrew Morton , David Rientjes , Ben Gardon , Johannes Weiner , linux-mm@kvack.org, LKML , Chris Mason Subject: Re: [PATCH v2] mm, oom: add rcu_barrier before hiding victim from the oom killer Message-ID: References: <20261202095450.296675-10-mhocko@kernel.org> <20261202212147.379270-1-mhocko@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Rspamd-Server: rspam08 X-Stat-Signature: wpp9x7kp69q91p1hdrtydpj3cgn4o56p X-Rspam-User: X-Rspamd-Queue-Id: A78FAA001A X-HE-Tag: 1796321502-774611 X-HE-Meta: U2FsdGVkX1/tWewIIFHRg8i/2xRjKLsrSGB9TIlI5043r2ZrJQtQdpLqjqGNIAEUa8rXlJ8Fbs9PIg9eu30sMHGqonYzvFNMaWzPe3YwDb/NWEfsKmBq6VsmZoHiXP9ulSlMthEwFhUMC3EOCND7c0fnLkUOKH2YOkhbJxcD4tVv/uTGFHo9j13XVvEyafyZMBnAx5/N4c2dOYdOxMmSI0Jf88qyAHkJzHCfOuxNYcS26dsLcR5OTpG/i+yD/Hb3/urTvJVYRlr6IMGget7ifa9SeFSYfRJ30pUbhoZo6qbhGocpvmJD9oxtLfUnWxeKTtNWzukWDqsbD1IlTeyevKpymTU3ZzwtYYN9Z1bI7o2nHtpKQOEmC6/nSg+zBAKvC7TaqzjpDbo3UU47sF9q2hATZ6dYRQxm1LoFa/6/9aJYv7vKxbbuDN9kXWFNmturOVs0vo/OtyMa1Ras93md6QZC6JZFJ9uYFGU3+O3hTYP3wNy59Flg3/tBwSKgdw2WdKuA6Abj1M+e5yNl5HHJyyk/LOFj5WeGqtB0n9fFq/zONDwzo2UatYOaxXTVSLdOJqt7N6+aiCCV4MdJ67xlRiY0xcihDFFbOjMKYmZKXzi15jQ0IgWNsZWlFvnGIF0XLuv7sy32IdtMUzdsfcRxXPZWdJJW4nqX+NazHNyvXDu1+B++Ug8cN9a3SM+ye6rGZO8TJzLIBzZl0y/uCB4UiS2KVGb1KLAf5ZufhUhbYJYNnraVoF246NqU2mwR2NNh9AnLN7GodrLTthSmKqQQ1ZyS17Qo6t9gSCcyfKWANFhTW9J5VIBsfmwR4iLEfxN1PDHrmvzPQKnTHsT07aDGXsIHZIVM8fVOM6v6GBGPaceKC0lN/f+7maQCm2IeLvmF6SaRHD/n1M/xQbagc9zwBqvjTZykSzeY2ximKt9PXxo3CnIGUuUOPOvv65z+2KfWQUieOJisYfhR/2JSsqW udmvOttN J2FwNsifzKEjFArtcGFrIqWslpLscV8MxkX7rE5kL1109KzPhR1xO77jQyr8PWHrPAnR8nmmwqlWwM3ym4B4p5CJDlq5LqjYsi52blCztKyYp6v1CQJkyXSf9I5y2wUQIZwe8V+tFU5o5ilV3deMSFyiaqyZWw8I2zF6MEKRvqq0gE6VVo4oVUFa90e9hJkfk43g9IALEjMOQGORjAsnmBFfwg30GaIUNuu/VMoOdxiYj/aa1A1RfYDE8XbZgVY2Dn0Di8nhV+5vnlD6ttJk6J5N3dJdO4EhuHnrCTQhyNVvvkUfGI8fF2m5VVKFeS9Pp4Xyk3nSjj7xQ5GTXe3i4TP9QsGGfV/x20GtrJ9bm8OTb6agxfL/yJB1aUfg2IgnVx216Eaa9lxU5CoF0jlka5611Ss59+UgXwcOi2w+KwS9ZGFN/EX430x7KclNiO0eJo4OHjAZ0z/G6vCAJD9k6DSjinuaLhRkZ8/P8MGNspCGdIPC1XauR/e/7Q91zFFqG1gTRdMKOgsrgT5p73kb8eSF+0F6R1vU3lLnU9+PB1egbaLDxMrLlVgKUp9S+Iucl8uypLXUHa/1p0RfzRpLUqUJzxzy7UhS5YuYxpQBVw4q2vY/sDv7tbYc2WQ== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Thu 03-12-26 09:39:53, Paul E. McKenney wrote: [...] > > And this is a super sensitive point - will this always result in forward > > progress? Could it be significantly delayed? > > Normal grace period latencies tend to be in the tens or hundreds of > milliseconds. And RCU CPU stall warnings happen when a given grace period > extends for more than 21 *seconds*, so long RCU grace periods can happen. > On the other hand, grace periods this long are (and should be) treated > as bugs. Yes, I guess it is expected that this can take a long time. And this particular patch adds it to two places: - exit_mmap for an oom_victim - oom_reaper The former is dying and if that takes longer while it is guaranteed to release its own memory from page tables which are freed through RCU then this is good. We do not even need a guarantee of a fwd progress here. The latter is more sensitive as it needs the guarantee of fwd progress. Although it doesn't hold any locks explicitly it ensures that the currently selected oom victims will be torn down - either through them exiting or remotely through the reaper. In either case they are declared MMF_OOM_SKIP in the end. If that takes longer then still not anything really earth shattering as long as this cannot block for unbound amount of time. > > Are there any lock dependencies that could be problematic? > > Given that you are asking this, I am assuming that if this rcu_barrier() > gets stuck, reclaim also gets stuck. > > You are not allowed to acquire sleeplocks in RCU callback functions, > and you are not allowed to hold spinlocks across an rcu_barrier(), so > at a high level, no. Thanks for the confirmation. That was my understanding. > One theoretical problem would be if RCU allocated > memory while doing a grace period, and the call to rcu_barrier() blocked > the grace period that its callback functions were in turn waiting on. > And there might be something like this that could happen when a CPU > was coming online for the very first time, especially if that CPU was > a rcu_nocbs CPU, which needs kthreads to be created. > > No locks involved, but self-deadlock nevertheless. Could you clarify a bit please? So this would be possible only during early boot while hitting OOM because RCU internals would be blocked on the memory allocation which cannot be resolved? > So maybe make that rcu_barrier() execute asynchronously? Well the thing is that we need to use it to order MMF_OOM_SKIP setting in the oom_reaper case. > And/or do a > synchronize_rcu_expedited(), also asynchronously? As this is mostly a best effort to ensure a lot of memory is not sitting to be freed in rcu callbacks then I would much rather just drop the rcu_barrier from oom_reap_task. -- Michal Hocko SUSE Labs