netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: Robert Love <robert.w.love@intel.com>,
	Lai Jiangshan <laijs@cn.fujitsu.com>, Ingo Molnar <mingo@elte.hu>,
	Jens Axboe <axboe@kernel.dk>, Neil Horman <nhorman@tuxdriver.com>,
	"David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	"Pekka Savola (ipv6)" <pekkas@netcore.fi>,
	James Morris <jmorris@namei.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Patrick McHardy <kaber@trash.net>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Stephen Hemminger <shemminger@vyatta.com>,
	Tejun Heo <tj@kernel.org>, Jarek Poplawski <jarkao2@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel@open-fcoe.org" <devel@open-fcoe.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 02/36] scsi,rcu: convert call_rcu(fc_rport_free_rcu) to kfree_rcu()
Date: Wed, 23 Mar 2011 15:24:56 -0700	[thread overview]
Message-ID: <20110323222456.GC2322@linux.vnet.ibm.com> (raw)
In-Reply-To: <1300889151.15899.4.camel@mulgrave.site>

On Wed, Mar 23, 2011 at 09:05:51AM -0500, James Bottomley wrote:
> On Tue, 2011-03-22 at 23:50 -0700, Paul E. McKenney wrote:
> > The kfree_rcu() definition is as
> > follows:
> > 
> > #define kfree_rcu(ptr, rcu_head)					\
> > 	__kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
> 
> Isn't this one of those cases where the obvious use of the interface is
> definitely wrong?
> 
> It's also another nasty pseudo C prototype.  I know we do this sort of
> thing for container_of et al, but I don't really think we want to extend
> it.
> 
> Why not make the interface take a pointer to the embedding structure and
> one to the rcu_head ... that way all pointer mathematics can be
> contained inside the RCU routines.

Hello, James,

If you pass in a pair of pointers, then it is difficult for RCU to detect
bugs where the two pointers are unrelated.  Yes, you can do some sanity
checks, but these get cumbersome and have corner cases where they can
be fooled.  In contrast, Lai's interface allows the compiler to do the
needed type checking -- unless the second argument is a field of type
struct rcu_head in the structure pointed to by the first argument, the
compiler will complain.

Either way, the pointer mathematics are buried in the RCU API.

Or am I missing something here?

							Thanx, Paul

  reply	other threads:[~2011-03-23 22:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4D82D071.5020703@cn.fujitsu.com>
2011-03-18  3:39 ` [PATCH 01/36] net,rcu: convert call_rcu(free_dm_hw_stat) to kfree_rcu() Lai Jiangshan
     [not found] ` <4D82D3FF.2080303@cn.fujitsu.com>
2011-03-18  3:41   ` [PATCH 02/36] scsi,rcu: convert call_rcu(fc_rport_free_rcu) " Lai Jiangshan
2011-03-22 17:28     ` Robert Love
2011-03-23  6:50       ` Paul E. McKenney
2011-03-23 11:22         ` Matthew Wilcox
     [not found]           ` <20110323112257.GD13806-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2011-03-23 13:30             ` [PATCH 02/36] scsi, rcu: " Paul E. McKenney
2011-03-23 14:05         ` [PATCH 02/36] scsi,rcu: " James Bottomley
2011-03-23 22:24           ` Paul E. McKenney [this message]
2011-03-23 22:45             ` James Bottomley
2011-03-24  0:32               ` Paul E. McKenney
2011-03-23 23:19           ` Matthew Wilcox
2011-03-18  3:42   ` [PATCH 03/36] net,rcu: " Lai Jiangshan
2011-03-18 19:35     ` David Miller
2011-03-18  3:42   ` [PATCH 04/36] net,rcu: convert call_rcu(__leaf_info_free_rcu) " Lai Jiangshan
2011-03-18  3:42   ` [PATCH 05/36] block,rcu: convert call_rcu(disk_free_ptbl_rcu_cb) " Lai Jiangshan
2011-03-18  3:43   ` [PATCH 06/36] net,rcu: convert call_rcu(__gen_kill_estimator) " Lai Jiangshan
2011-03-18 19:35     ` David Miller
2011-03-18  3:44   ` [PATCH 07/36] net,rcu: convert call_rcu(ip_mc_list_reclaim) " Lai Jiangshan
2011-03-18  3:44   ` [PATCH 08/36] net,rcu: convert call_rcu(ip_sf_socklist_reclaim) " Lai Jiangshan
2011-03-18  3:45   ` [PATCH 09/36] net,rcu: convert call_rcu(ip_mc_socklist_reclaim) " Lai Jiangshan
     [not found]   ` <4D82D4C2.8020503@cn.fujitsu.com>
2011-03-18  6:59     ` [PATCH 05/36] block,rcu: convert call_rcu(disk_free_ptbl_rcu_cb) " Jens Axboe
2011-03-18 11:20       ` Matthew Wilcox
2011-03-18 15:24   ` [PATCH 01/36] net,rcu: convert call_rcu(free_dm_hw_stat) " Neil Horman
2011-03-18 19:35   ` David Miller
     [not found]   ` <4D82D4AA.2080601@cn.fujitsu.com>
     [not found]     ` <4D82D4AA.2080601-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2011-03-18 19:35       ` [PATCH 04/36] net, rcu: convert call_rcu(__leaf_info_free_rcu) " David Miller
     [not found]   ` <4D82D508.5080901@cn.fujitsu.com>
     [not found]     ` <4D82D508.5080901-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2011-03-18 19:35       ` [PATCH 07/36] net, rcu: convert call_rcu(ip_mc_list_reclaim) " David Miller
     [not found]   ` <4D82D52E.1010501@cn.fujitsu.com>
2011-03-18 19:35     ` [PATCH 08/36] net,rcu: convert call_rcu(ip_sf_socklist_reclaim) " David Miller
     [not found]   ` <4D82D544.6090509@cn.fujitsu.com>
     [not found]     ` <4D82D544.6090509-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2011-03-18 19:36       ` [PATCH 09/36] net, rcu: convert call_rcu(ip_mc_socklist_reclaim) " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110323222456.GC2322@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=James.Bottomley@suse.de \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=devel@open-fcoe.org \
    --cc=eric.dumazet@gmail.com \
    --cc=jarkao2@gmail.com \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=pekkas@netcore.fi \
    --cc=robert.w.love@intel.com \
    --cc=shemminger@vyatta.com \
    --cc=tj@kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).