From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ilvokhin.com (mail.ilvokhin.com [178.62.254.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7249635F5E4 for ; Tue, 3 Mar 2026 12:57:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.62.254.231 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772542670; cv=none; b=PcRtUpP5USY23O2AQ9WJJKg+ORg3Gge7zNGa3VCJ2Yf2uxP3DS5OkSij0xPHoO8Pn2hDJAvHft6iEDlbfpiWlRreEkT81jCa7b6hzEo66Tri64garLjmO3jKSnuLT1JC4fhzbBtcuO1sh+UaG80y4zhWTncLnnBwlxX0E6bZc2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772542670; c=relaxed/simple; bh=uk7xdQCSENBSXbRlZ1ZztobIdiQijP6ur3Vzs1vli1s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p4SMuwQepkF8SZ+9jpyLJX6/9JWLz1TfobCYrQLel70SY++Bc7SwSiBRQm6eZgvNpurafoO38iMy638s+GUmYNfCJgTdGC2a1IUgxct5lSx1H2upGkd3+dQk78BLxV7likM/JdtJ21ZwGMrReXpCFDb6bg36xRyb989ggnWF648= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ilvokhin.com; spf=pass smtp.mailfrom=ilvokhin.com; dkim=pass (1024-bit key) header.d=ilvokhin.com header.i=@ilvokhin.com header.b=rJYBl+yV; arc=none smtp.client-ip=178.62.254.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ilvokhin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ilvokhin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ilvokhin.com header.i=@ilvokhin.com header.b="rJYBl+yV" Received: from shell.ilvokhin.com (shell.ilvokhin.com [138.68.190.75]) (Authenticated sender: d@ilvokhin.com) by mail.ilvokhin.com (Postfix) with ESMTPSA id 725EFB30F5; Tue, 03 Mar 2026 12:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilvokhin.com; s=mail; t=1772542666; bh=kIb3XKow0Btqlt+PMaDiNSWvQvGqJs93pY6JvvoFo5g=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=rJYBl+yVoN1GXIomdl1TvEw4wtVbdCklbsEo3ffV2l7V0/8vfIFuFTpUaDU5w/pZU IS+jW6l/fQDOm7o0wMBvqs7mzKfbXodWWSFfxm42ZCw5bMdmSgXuMqZ1LkhnN6j3JC WitFR8/yUIDe9bPUKkzFX+YdJbYXAqSAgcIjCcwo= Date: Tue, 3 Mar 2026 12:57:42 +0000 From: Dmitry Ilvokhin To: Maninder Singh Cc: mhocko@suse.com, rientjes@google.com, shakeel.butt@linux.dev, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] mm/oom_kill.c: simpilfy rcu call with guard(rcu) Message-ID: References: <20260303102600.105255-1-maninder1.s@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260303102600.105255-1-maninder1.s@samsung.com> On Tue, Mar 03, 2026 at 03:56:00PM +0530, Maninder Singh wrote: > guard(rcu)() simplifies code readability and there is > no need of extra goto labels. > > Thus replacing rcu_read_lock/unlock with guard(rcu)(). > > Signed-off-by: Maninder Singh Reviewed-by: Dmitry Ilvokhin > --- > mm/oom_kill.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 5c6c95c169ee..9e3e88c06ead 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -135,19 +135,16 @@ struct task_struct *find_lock_task_mm(struct task_struct *p) > { > struct task_struct *t; > > - rcu_read_lock(); > + guard(rcu)(); > > for_each_thread(p, t) { > task_lock(t); > if (likely(t->mm)) > - goto found; > + return t; > task_unlock(t); > } > - t = NULL; > -found: > - rcu_read_unlock(); > > - return t; > + return NULL; > } > > /* > -- > 2.34.1 >