From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796321503; b=J6jtVfzGJoc84N/G8CM7wkttaDcloUPr9LC+AtMLusPuApkr4SR49WH2Onbjr3W95H4t EuzHNFXU41bHKMzMaxFcchOi4nPNOFN7EADpjhmuDk6ph3e+8vzVZmVUlt8KKdpfxuYJP LGiaDkNyFWFpuMu7kZEhYNo7moQ+7m0/5a16o4EWwfv6T0r2LoLB0iR+qmZsx0nlHJKAM zGTg3MiIxvCgwlPGwkhjZvykY85MIfE7GbNibr0oLovVLiKmiaRY72W/+90qXeHAmLZ0I CaCx3+qlQ+5D+SxF3oRG6vYjaSuHI26S5efOWYRmLCKmabKk2yd0MEYXLU9Yb4CBuYw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796321503; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=D6HX7hcBzGg8lNT92wfwkQoPti1WWhPyjlWz81oIyt8=; b=eTXwCaIVdSszTg2BwQgZsA/IZ3w/Xp0zf123ThiLzW54bIV0RwnT7kicKh+bDOzVU0ey +nfPW7U0fmbdJIR7GajghOwhfm2/+imO2m/EuJShGTPpCFsTrMB5QS41eQfLsZqwBe1+f nOqCXGWn4GC/ah46eRqm0ONIZg9K2GHPsQA4Jp28ATBiZH36qz0I07xcs+Gnkljb24CcI hciy3qno8Cx03xnybpL5fN8pphL+SpPpgxvCj3YPvCb4PFV541rQL17/OQVETtEQIscFs s7da6z0LHeaWnPK3bN8ob+IO2UURA8R74sed15eD6CVMaQK2GBf/1VDVfm75002jZyw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=dZEAhwLX; arc=none smtp.remote-ip=209.85.128.48 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8870606A322 for ; Thu, 3 Dec 2026 18:11:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A8870606A322 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 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=dZEAhwLX Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4bba5e17728so292645e9.2 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=vger.kernel.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=dZEAhwLXC4/mxd7enDe0/whddX0Jm65e2Ajfo4d77ARF4k3zG1uls92vP5XdMudFC5 Iq2zaZwbLXrggYG1yfF14hD/rTBfG3aMu0wS7VodCgownCS65sKSrbk9zDSwAqA4lagL quGm7FXs1Li4EWSvcktP1XuTj5jmZxNqcpiq1zT/0jntAtAOSx2BhgsTEusZpxcRlMFn 9b1HvH5uY+xvfQdslFi4MoxG+umb974FYFV6i9R7VsLCvqFFswjoEqscSne0vydrM+o0 Fft3peKKj/G8w7aOQFxfTqz+8QkGtYd8hm3Vu0pAZQDYC8ZSZcGMrF9Co/T7EKBSCzoI ptSg== 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=CvgOOM9aNDcwiFcxoJyU3H8UAZV7/2yRchDCOQifqlhXekZg7iC1Jtbkb7A22FNLO1 Vo+Uk1XkBmgC0CB7r2rLgfpeVIJ7Sf3sSDeVIgbV6lUwMM/v2+Jb3c5uUywUak6LvzOy wP5+ENciJJjUeF0gOrDUDXg2Uc3pwZZNScT5LC6UZVbjId4NWwu2cr1mfL2ksWwt3mB6 P3gMokusI6ftb/n33KOq3Na2a8PNRwOACCL2LAlCt8N5Ehxpuh4A4qkCrZq2ivYFIGSx mhuxJlG+eejIxYIWM/uheHgTNWyT+nL+68iFXRLZZGvX9BQUgYfN42QaPkoZp5zHs8VN H2Qg== X-Forwarded-Encrypted: i=1; AL+hErH3EKqLqJpxcPgyRl8z+NpghQw+fgoHLMD6UhbMVlF54gvX+fw6iwZpJ8vQGxggOLvSj/6gALtDystoOic=@vger.kernel.org X-Gm-Message-State: APuU4Z8WQ3sqwk8PGH63WkkxLQZCgzvjL27v2Vw/eRxf+8UJWujNvrI8 e4UQUOkfTJ+AOabcNQyd93HsqOLXbffN+fzUr9BleKEBLRI4jSgfylD7glZlL4aC7NA= X-Gm-Gg: AZFdTZduktpYp7+cCGSCEp4nJLIfi+4hI2ZPTt1fOVI9X5pxo1m7njZka902hi3E+5x iYYc8VCzrKuzqgwqDbVfVFsRJXX5TdeljxnLyLX7hxPpG58DEVNtBOFvFTzNDhF4J7Ol+fzCfJt iK22KqQmQa35HzBBTUxOGLx/BS6SKzgNhFM3nnDNzrbj+aFoAnk2a0ZqVO0p+3KlbNs0H2ixKy4 r4+87DoDcmNbORyR3G0c+CuFc6V4pi4m7PhSAXBylxYQrjk1wc8WATebbhYjEQQU70O7RNgGqDi dhYAUEexUo3+6X+W7Ntaw7rNOE+DARw0vVfCAEkz0YLRcQWr7cMBRhxH1L+60FngVI6dcsRu/Ri dIltcXZLAnaYTXechV+oKSdkdo4gM7smSRv4dYpFz62kasG9nekXGCwhl6UNWicP5KQUd53AwFU Jp2Mtvw8LWLIk1JQQKgjwZi8hlBqRG5Xfu/vG93ggPZWzh0AUBgxpBPwz2A05dqcHQJ2mKZhB+B wyrBSjpQSZXyrt9ZeUrEI66QqxqocpahgWSVzkQl5Zeo4NKYhhVlvVEmDzL1M1mSzuSLnTd1UAH WAd+DIp4k4AF6jatQhc/3CLrynYPpT1qCaiFS3Wgrw== 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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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