Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1866380ybl; Thu, 30 Jan 2020 07:23:32 -0800 (PST) X-Google-Smtp-Source: APXvYqy9i7z3zutAMFf4m9rrTY3PWLYyMHqqVYwRHy3WAzJSvIXzvnYiL4p3h13MLgbZwbyy0pA4 X-Received: by 2002:aca:3109:: with SMTP id x9mr2677906oix.107.1580397812461; Thu, 30 Jan 2020 07:23:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580397812; cv=none; d=google.com; s=arc-20160816; b=VlSyW6AYVU/sfVwn7aCdReC3Wtz+Sa7o7AM+1R54vi7wVUKcL3BwnXKRiz+X2i0SvO gViZEe61YveLyF6PaFekBN0JiQ89FDTpwEOBb63VFbI9QOv/QUxJ3wnROxhkuXJKLYzl NCUNdgCbZViv+k9wFsT47fhm5lf7z34L/PLh5UHDV5+FOYC6pvy71q1qAL+dhYKVEIKF keShoBw/1nzmX8TRdg8hH05aogNKD2keenZXZGlRtil7TCAut+md5Werwc9C5SeiS3UK PEdxbEeeec8DSQA+n/VuLzzF57qtOENqGNrIUjUcXsGJYqf3fwgS+Z/K1ip1qmD1ILwn IEcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=0ElgkMyOtQ0UIceuFuPMOrGzkluJsTLXTmcsWWN+DFo=; b=SpOfysFbjG/UQ937nC53GLFzMRSuhZzTtrSJHAkcvLNvMzLidQJbj73pmLJI8slZHb KxG3eErJiJqDRw8rwbgOjn8WQwzfBPEQHnjYzldc7ezQ78qg6ApWFKWAeoV+n10A2vY/ fiiwf/xr+uG5hVj4Q18tKWibXOlxCNWbTTu47OHHjgDSCeBuw0PPsXSi6tbTa8YyYpJs xQXfjQOCJWbyzCBXLRcF6H0XX7X2jI+GlYIxjhoLoCMu+9zj+LXGMGQJbVheIkXhkVw9 XUxgr8A6Ltxi+nd+4rRVXTcmGzzLH5vilF2R89NsH3+PQGMhoId5UUEPgKQrA7sGKUYL IJhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si3268991oti.47.2020.01.30.07.23.20; Thu, 30 Jan 2020 07:23:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727308AbgA3PUv (ORCPT + 99 others); Thu, 30 Jan 2020 10:20:51 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:33392 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727186AbgA3PUv (ORCPT ); Thu, 30 Jan 2020 10:20:51 -0500 Received: from [109.134.33.162] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ixBca-0004pl-BA; Thu, 30 Jan 2020 15:20:44 +0000 Date: Thu, 30 Jan 2020 16:20:43 +0100 From: Christian Brauner To: Oleg Nesterov Cc: madhuparnabhowmik10@gmail.com, peterz@infradead.org, mingo@kernel.org, paulmck@kernel.org, linux-kernel@vger.kernel.org, joel@joelfernandes.org, linux-kernel-mentees@lists.linuxfoundation.org, rcu@vger.kernel.org Subject: Re: [PATCH] exit.c: Fix Sparse errors and warnings Message-ID: <20200130152043.kgcf5s6h6qaalpbl@wittgenstein> References: <20200130062028.4870-1-madhuparnabhowmik10@gmail.com> <20200130103158.azxldyfnugwvv6vy@wittgenstein> <20200130113339.GA25426@redhat.com> <32DE6B3E-ADC3-49EB-888C-CABCF82330FE@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <32DE6B3E-ADC3-49EB-888C-CABCF82330FE@ubuntu.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 30, 2020 at 12:45:26PM +0100, Christian Brauner wrote: > On January 30, 2020 12:33:41 PM GMT+01:00, Oleg Nesterov wrote: > >On 01/30, Christian Brauner wrote: > >> > >> On Thu, Jan 30, 2020 at 11:50:28AM +0530, > >madhuparnabhowmik10@gmail.com wrote: > >> > From: Madhuparna Bhowmik > >> > > >> > This patch fixes the following sparse error: > >> > kernel/exit.c:627:25: error: incompatible types in comparison > >expression > >> > > >> > And the following warning: > >> > kernel/exit.c:626:40: warning: incorrect type in assignment > >> > > >> > Signed-off-by: Madhuparna Bhowmik > >> > >> I think the previous version was already fine but hopefully > >> RCU_INIT_POINTER() really saves some overhead. In any case: > > > >It is not about overhead, RCU_INIT_POINTER() documents the fact that we > >didn't make any changes to the new parent, we only need to change the > >pointer. > > Right, I wasn't complaining. RCU_INIT_POINTER() claims that it has less overhead than rcu_assign_pointer(). > So that is an additional argument for it. > > > > >And btw, I don't really understand the __rcu annotations. Say, > >according > >to sparse this code is wrong: > > > > int __rcu *P; > > > > void func(int *p) > > { > > P = p; > > } > > > >OK, although quite possibly it is fine. > > > >However, this code > > > > int __rcu *P; > > > > void func(int __rcu *p) > > { > > *p = 10; > > P = p; > > } > > > >is almost certainly wrong but sparse is happy, asn is the same. > > That's more an argument to fix sparse I guess? > The annotations themselves are rather useful I think. > They at least help me when reading the code. > It's not that rcu lifetimes are trivial and anything that helps remind me that an object wants rcu semantics I'm happy to take it. :) > > > > > > >> Acked-by: Christian Brauner > > > >Acked-by: Oleg Nesterov Thanks, applied for post -rc1. Christian