Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796240677; b=cgYONp7p8UkPGr9rG1dUP8jptZITADLn5PvrwTvIb9s2H4rZSi0WNFjMu/3pqGlwdI0a Y+M8fXNEDflO6lINTFcNn8tnTpo4Tf0H5/TDig51T+u7ZPbtEtk6yL7Sa2lBWWHJkaeJg LCG3QkqjgM1zU6XHNFifwbNqdo0flh+dW8aBT9z+cHiJ2F5VrDly7l02Dnj+9PgmTSdzJ TjKX9YTCiY1yRHeXLPxUgBlnSeEnkLu7TWPY9TwyAXCwZLxGNGG4H5mmcWR8UTRbwkSUV sXg4lHlZ0niPNJzfa/DPNmnF0sLXvFi67o8tPFen0kpH5fOvacfaMW1ieiTbjXXTPLw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796240677; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; bh=rWzlPPagHpZO1oxyVx3L7006CLiusBbH9aDOKiatIZI=; b=w/022KwSi/p80ZJ625xdgmPNjC9Jzp9w+6YER8T7hOxbFaZOMmZg1HAamsqEDNp87yRS ODhNrDIoS0Eh6Ig8M+oCXJPnVUzQuUapHmM93UX34/lQe804Rj4BIDa3nejKS+Q9rw7XS NgU4wrlrEABLA85DSTUXu4V5sTKJKeGZJ3MO2FaGxBPIZcJInvYrSv4T6JG1w9qwQ1w0F avO9sETMpk7YlwTYbA+PAhig6h+umYav0gZQIGcmvC0T+EUNDyR6PeLjvCAmoCcRIRi3L 6lbIU9PCWvw8eFr6JdS048J0t9maRCtLzCiLPOnMcQyVKBmJhDgLvCrKq6xVxYgEVzA== 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=YlLOvlBE; arc=none smtp.remote-ip=209.85.128.54 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 62CF6606A32C for ; Wed, 2 Dec 2026 19:44:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 62CF6606A32C 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=YlLOvlBE Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4bba5e17728so70004845e9.2 for ; Wed, 02 Dec 2026 11:44:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1796240676; x=1796845476; darn=lists.linux.dev; h=in-reply-to:content-transfer-encoding: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=rWzlPPagHpZO1oxyVx3L7006CLiusBbH9aDOKiatIZI=; b=YlLOvlBE2vHHp/6MFFCvj95EOHuSWAKNru/w/LRidXc/b6CsW5GFNdxLjlXbW8qQYz xit3TOfhBSHYTOUhjl4KyGFN9kkIXWT5u4C2I/LGpvcE5L+o3MksdXxCb0VRR2oe3lZL vU9YsJeUh8I4jR427x90dr6csH1cx9P7llXtAweScW4u/9NAyd3tAtxQrDHxV32ruNn+ +tUt0BOSpGe/sij/wIkZRoyy8ntzZXQtYQM7yTkI6BrRnmUkjHFDDxgMiOuj52BwdaVn +iZ/lBzy+xE9wNkBMIzQrFBRIUOSaxSXUJeR0X4DnYkpcHXeOqXWOZVGXsq+X6XOB22d iy2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796240676; x=1796845476; h=in-reply-to:content-transfer-encoding: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=rWzlPPagHpZO1oxyVx3L7006CLiusBbH9aDOKiatIZI=; b=iOKpcm/Or6g2C9R34NBGbnFrN3tJpWU3+cZMXWl02dYYjSXfgLy7tn/UrsrgmbbC5F fSUw4f8Vb6ovdR/kOM8hwgNn9m8QOZnw7LwXYvZldyAC9jCfpH1CvLaL2Te01+k/gadb k9Ir1TZM2DC/waw2/nvBqrin3BgLi7kW19nXDzdUSqFw0bccqe+ErBZuY+aRhhdOMIzx Or05x77vlo//weFAttaPU+71PpOeyv6+/D9p4r4oz+PGCrme6AOqOMCX5/5qHi1l+m5+ sKaA8kfqygxfKVJ1NmzfRmMomYN/Qx863Mp8ZVeWxVMF27LNTC5sm+vHQ4vKkCXuoUc6 034A== X-Gm-Message-State: APuU4Z+FfkHEQG2jxQf7FuaBBjruiRrwvNTQm4V9B3aQzFeC9VULb+Dv HbTbGUU0nLsDqMQWFdvF6IiksqORAHO5KgcIchf6ihpEUGjd1yoESf5LyfIdPqvYhkoU5/sSC9W B600NFBM= X-Gm-Gg: AZFdTZeOiQRIupdwinjGaCmfEJG87luurCPhZ3Awj23/D5gE7FXB+xl9x5RizRb1PnU qiHtZ/mWv1ogUnKwinEo4IESnORv99cJ9ReT5lckxNpvNWJXmuS56Pknt4AXNP37M9g3iuk88JM 0Ey7Z9QZJ+Sq/Pz/BVcPA4dMrAN7rMtXieF8vuIiS3zmMePg73d3aUGdG3LSepF/xA7E/y/Pg0c 7aoIC3zg8+XxmZ/MmgkMaSpK7bMmIeDHzoY0nPjeZioZpVoUygPT7/L7CaJlIJvnTSwzac9foJm 9CWR1SYU0bK/Y0X0NOEuce8MVE8wL9qpEAlu7psb9QAulJC7UBhCcRxh+jDOJaSH1m5rthr4tXh jQEL5S1oDmtHTZLp/0duGubv60E4L0noy7TDrhdWHziSgbG0UmHF/lpeKHTVla0kUUTNxBk/1nS DabLIjGsQDRLIjKUHMUOxP6Dv1+sLv9O13QDDPDeUqbRN13qAgqa+LQA5ObObjCpQEMZ5W5Zkla reCxgvZ6OmonhKRUvuf09MlXfc8RSiUhywnnZ3B5OWAfH6bxBIWYfgN+ZMvrouCZGMrv+e+kywQ 7kE7chVU5d5GGQJ3+vzUw1PQqZax2XdPDwmGFZs= X-Received: by 2002:a05:600c:3508:b0:4b2:3c81:d1 with SMTP id 5b1f17b1804b1-4bb88826921mr838768345e9.5.1796240675813; Wed, 02 Dec 2026 11:44:35 -0800 (PST) Received: from localhost (109-81-21-11.rct.o2.cz. [109.81.21.11]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb90660cb4sm1124499325e9.2.2026.12.02.11.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 11:44:35 -0800 (PST) Date: Wed, 2 Dec 2026 20:44:34 +0100 From: Michal Hocko To: sashiko-reviews@lists.linux.dev Cc: David Hildenbrand , David Rientjes , Ben Gardon , Johannes Weiner , Andrew Morton , linux-mm@kvack.org Subject: Re: [PATCH 08/10] mm, oom: wait for rcu_call callbacks before retrying reclaim Message-ID: References: <20261202095450.296675-1-mhocko@kernel.org> <20261202095450.296675-9-mhocko@kernel.org> X-Mailing-List: sashiko-reviews@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed 02-12-26 16:31:02, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 2 potential > issues to consider: > - [High] mm: rcu_barrier() in should_reclaim_retry() runs after zone > watermark check > - [High] mm: should_reclaim_retry() calls rcu_barrier() even when > reclaim progresses > -- > > commit 80d44083709f0dc6896c3ee8f1c5829f534bd7fa > Author: Michal Hocko > > mm, oom: wait for rcu_call callbacks before retrying reclaim > > This commit adds an rcu_barrier() call in should_reclaim_retry() to wait > for in-flight RCU callbacks to free memory before retrying reclaim. > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index aa1ed599c7c6b..c4dc421e7edf1 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -4713,6 +4713,9 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order, > > schedule_timeout_uninterruptible(1); > > else > > cond_resched(); > > + > > + /* Wait for any potential call_rcu memory freers */ > > + rcu_barrier(); > > out: > > /* Before OOM, exhaust highatomic_reserve */ > > if (!ret) > > [Severity: High] > Does running rcu_barrier() after the zone watermark loop cause > should_reclaim_retry() to return false without re-checking the memory just > freed by the RCU callbacks? > > Pages waiting on call_rcu() are not counted in zone_reclaimable_pages() or > NR_FREE_PAGES until their callbacks run. When remaining LRU and free > pages are below min_wmark, the loop leaves ret as false before > rcu_barrier() drains the pending callbacks, so should_reclaim_retry() > still returns false and __alloc_pages_slowpath() proceeds straight to > __alloc_pages_may_oom() instead of retrying the allocation. > > [Severity: High] > Should rcu_barrier() be skipped when direct reclaim made progress > (did_some_progress is true and *no_progress_loops is reset to 0), similar > to how commit "memcg, oom: wait for rcu_call callbacks before retrying > reclaim" only calls rcu_barrier() in try_charge_memcg() when nr_reclaimed > is zero? > > Calling rcu_barrier() unconditionally on every should_reclaim_retry() pass > serializes all multi-pass direct-reclaim threads on > rcu_state.barrier_mutex, sends cross-CPU IPIs, and waits for a full RCU > grace period even while normal reclaim is actively freeing pages. Fair point. I will think about some more. I have to admit I am not entirely convinced about this patch. I should have probably marked it RFC. > -- > Sashiko AI review · https://sashiko.dev/#/patchset/20261202095450.296675-1-mhocko@kernel.org?part=8 -- Michal Hocko SUSE Labs