Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1671710ybl; Thu, 30 Jan 2020 04:04:20 -0800 (PST) X-Google-Smtp-Source: APXvYqx1y6ZvpqI1QY79GP95wIK1xTck49ppbpfT18EBYaUpoPstZ4DC1KbgF32wN+agZHxxjRa4 X-Received: by 2002:a05:6830:1651:: with SMTP id h17mr3071234otr.167.1580385860369; Thu, 30 Jan 2020 04:04:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580385860; cv=none; d=google.com; s=arc-20160816; b=b44UlOHBqky4d0YpcWycxvlbbhTJ+Unavsk1J8wBLlT272a9jn6CSg2cFKMyeAVWI9 y1SbuJ2Tu4+33nytYLCNvCcIgV5IsZu2nZPEn+R6J/yLvSGZzMZwPqcA0W6huxlKXlkL 55NhYNtVzu9TLYAurSnMTZEAbZQCuqPyt6ayakbpC1YGcdxscEnk9x9mTvt7IYmPybtG 6NrlutA2u1Xg0aCTa3mmOBLW6qinEXH1gUdUh50//k7ccaMaeZJCcpFkTgDrZ3i1Yu90 2F1vliX/r7DePG6lWSM4vCHaCiznpNh0NT1F4fTkoJi7AstXgvivup8zPHeIT2YfMXl0 b61Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date; bh=EzSPHzzcqnqCvZUGqj1vKmlJxZTiyAJs2ucaG+iSt9g=; b=RUJaYTqfG5RJD7FmZk+c0FdQdOLk1U8++ZtWifZYvch0fq0MhlkRXYTcJWri7xRs9w gUTO+7I1FOR23fT+jn6j0kKhMVwfvDM7ZkMT7OIKhWQKcqyPff8wN+KmxSYrJuuFY0Cs 6i1uhl3Ahk5DPzI9lmxja69gxdeDD6mbQ6Ja2wwwP9W6Yk/1F6j7pPlFdAK/tmIwEpRa 2NRItVr3ZFMdPV8H0OkZzCiwJNXX1pxuuR/2Vpb0c1bPv6ge4emNsS9bbk/SBZeStzEK Mj4fxLAuEOwFXPBAE6KwJx3/CyE6wthkrut+2VuDfH1EVEQ9/hweJ3/FNFXkaPB9bRot Dghw== 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 o15si2943497otp.314.2020.01.30.04.04.07; Thu, 30 Jan 2020 04:04:20 -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 S1727229AbgA3MCu convert rfc822-to-8bit (ORCPT + 99 others); Thu, 30 Jan 2020 07:02:50 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39866 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbgA3MCu (ORCPT ); Thu, 30 Jan 2020 07:02:50 -0500 Received: by mail-wm1-f66.google.com with SMTP id c84so3912381wme.4 for ; Thu, 30 Jan 2020 04:02:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=Eti0yRnmjwLs2yRe1krSvPdmZnl0PtvNqJ94tkjn534=; b=kkKsJE5o7fnQpWjt6/nrllPjmwTjb822a27IWsTqVCWCjL8A3dpa550lKZBRVj1HWw 1mu2qLTjAx8MTOXijLsV7MqIzzcocE1zxstE+N+eJ3ZIm+hliSKsbmncfvVv2xqLW4z8 1bvWXU/mdHtEl8ww6WPMhBCc3wAaeP+sf866Xs7ff2hR4d/BLbQ6nVgXZZUOWFAwdY1e KDAPLJYooe50lvtcEi4F7sFTn+ZDPmOdUSabZTiKPRfP79cptGdWB2ID1gk8dkX3MjI0 Mdvsk0D/FqYICvTQQe3sywRaOvoOP2y8n4bR82K/gueWrZJZvxXJ1jDCD+P26RWHpL1V U0tA== X-Gm-Message-State: APjAAAW5ZeRVkcRza3iSFAJAV5nwkb+dSjqrMXbNU1sD0uYpW6Cimqqw FVmWYvRfXowPl/R67YpPBUkGog== X-Received: by 2002:a1c:f008:: with SMTP id a8mr3810733wmb.81.1580385767515; Thu, 30 Jan 2020 04:02:47 -0800 (PST) Received: from ?IPv6:2a00:20:8033:fc11:1c15:76bc:997f:b2bd? ([2a00:20:8033:fc11:1c15:76bc:997f:b2bd]) by smtp.gmail.com with ESMTPSA id h8sm7282645wrx.63.2020.01.30.04.02.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jan 2020 04:02:46 -0800 (PST) Date: Thu, 30 Jan 2020 12:45:26 +0100 User-Agent: K-9 Mail for Android In-Reply-To: <20200130113339.GA25426@redhat.com> References: <20200130062028.4870-1-madhuparnabhowmik10@gmail.com> <20200130103158.azxldyfnugwvv6vy@wittgenstein> <20200130113339.GA25426@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [PATCH] exit.c: Fix Sparse errors and warnings 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 From: Christian Brauner Message-ID: <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 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