From: Nick Piggin <npiggin@suse.de>
To: Balbir Singh <bsingharora@gmail.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
Nick Piggin <npiggin@suse.de>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Memory Management <linux-mm@kvack.org>
Subject: Re: [patch 1/3] radix tree: RCU lockless read-side
Date: Mon, 13 Mar 2006 07:40:48 +0100 [thread overview]
Message-ID: <20060313064047.GA2090@wotan.suse.de> (raw)
In-Reply-To: <661de9470603121904h7e83579boe3b26013f771c0f2@mail.gmail.com>
On Mon, Mar 13, 2006 at 08:34:53AM +0530, Balbir Singh wrote:
> On 3/11/06, Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> > Balbir Singh wrote:
> > > <snip>
> > >
> > >> if (slot->slots[i]) {
> > >>- results[nr_found++] = slot->slots[i];
> > >>+ results[nr_found++] = &slot->slots[i];
> > >> if (nr_found == max_items)
> > >> goto out;
> > >> }
> > >
> > >
> > > A quick clarification - Shouldn't accesses to slot->slots[i] above be
> > > protected using rcu_derefence()?
> > >
> >
> > I think we're safe here -- this is the _address_ of the pointer.
> > However, when dereferencing this address in _gang_lookup,
> > I think we do need rcu_dereference indeed.
> >
>
> Yes, I saw the address operator, but we still derefence "slots" to get
> the address.
>
OK, I reread what you wrote and I misunderstood you earlier I guess.
slot->slots[i] does dereference the pointer at the ith entry of slots,
but &slot->slots[i] does not, it will return the same thing as
slot->slots+i, which only dereferences 'slot' (which we've established
to be safe).
Even if &slot->slots[i] did, for some silly compiler, dereference the
pointer, we never actually see it or use it so it should be harmless.
Nick
WARNING: multiple messages have this Message-ID (diff)
From: Nick Piggin <npiggin@suse.de>
To: Balbir Singh <bsingharora@gmail.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
Nick Piggin <npiggin@suse.de>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Memory Management <linux-mm@kvack.org>
Subject: Re: [patch 1/3] radix tree: RCU lockless read-side
Date: Mon, 13 Mar 2006 07:40:48 +0100 [thread overview]
Message-ID: <20060313064047.GA2090@wotan.suse.de> (raw)
In-Reply-To: <661de9470603121904h7e83579boe3b26013f771c0f2@mail.gmail.com>
On Mon, Mar 13, 2006 at 08:34:53AM +0530, Balbir Singh wrote:
> On 3/11/06, Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> > Balbir Singh wrote:
> > > <snip>
> > >
> > >> if (slot->slots[i]) {
> > >>- results[nr_found++] = slot->slots[i];
> > >>+ results[nr_found++] = &slot->slots[i];
> > >> if (nr_found == max_items)
> > >> goto out;
> > >> }
> > >
> > >
> > > A quick clarification - Shouldn't accesses to slot->slots[i] above be
> > > protected using rcu_derefence()?
> > >
> >
> > I think we're safe here -- this is the _address_ of the pointer.
> > However, when dereferencing this address in _gang_lookup,
> > I think we do need rcu_dereference indeed.
> >
>
> Yes, I saw the address operator, but we still derefence "slots" to get
> the address.
>
OK, I reread what you wrote and I misunderstood you earlier I guess.
slot->slots[i] does dereference the pointer at the ith entry of slots,
but &slot->slots[i] does not, it will return the same thing as
slot->slots+i, which only dereferences 'slot' (which we've established
to be safe).
Even if &slot->slots[i] did, for some silly compiler, dereference the
pointer, we never actually see it or use it so it should be harmless.
Nick
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-03-13 6:40 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-10 15:18 A lockless pagecache for Linux Nick Piggin
2006-03-10 15:18 ` Nick Piggin
2006-03-10 15:18 ` [patch 1/3] radix tree: RCU lockless read-side Nick Piggin
2006-03-10 15:18 ` Nick Piggin
2006-03-11 8:22 ` Balbir Singh
2006-03-11 8:22 ` Balbir Singh
2006-03-11 8:48 ` Nick Piggin
2006-03-11 8:48 ` Nick Piggin
2006-03-13 3:04 ` Balbir Singh
2006-03-13 3:04 ` Balbir Singh
2006-03-13 3:11 ` Nick Piggin
2006-03-13 3:11 ` Nick Piggin
2006-03-13 15:24 ` Balbir Singh
2006-03-13 15:24 ` Balbir Singh
2006-03-13 22:37 ` Nick Piggin
2006-03-13 22:37 ` Nick Piggin
2006-03-14 3:32 ` Balbir Singh
2006-03-14 3:32 ` Balbir Singh
2006-03-14 5:16 ` Nick Piggin
2006-03-14 5:16 ` Nick Piggin
2006-03-13 6:40 ` Nick Piggin [this message]
2006-03-13 6:40 ` Nick Piggin
2006-03-10 15:18 ` [patch 2/3] mm: speculative get_page Nick Piggin
2006-03-10 15:18 ` Nick Piggin
2006-03-10 15:18 ` [patch 3/3] mm: lockless pagecache lookups Nick Piggin
2006-03-10 15:18 ` Nick Piggin
2006-03-10 15:18 ` [patch 4/3] mm: lockless optimisations Nick Piggin
2006-03-10 15:18 ` Nick Piggin
2006-03-10 15:18 ` [patch 5/3] mm: spinlock tree_lock Nick Piggin
2006-03-10 15:18 ` Nick Piggin
2006-03-13 23:35 ` A lockless pagecache for Linux Christoph Lameter
2006-03-13 23:35 ` Christoph Lameter
2006-03-14 4:14 ` Nick Piggin
2006-03-14 4:14 ` Nick Piggin
2006-03-14 12:59 ` Wu Fengguang
2006-03-14 12:59 ` Wu Fengguang
-- strict thread matches above, loose matches on Subject: below --
2006-04-04 9:31 [patch 0/3] lockless pagecache Nick Piggin
2006-04-04 9:31 ` [patch 1/3] radix tree: RCU lockless read-side Nick Piggin
2006-04-04 9:31 ` Nick Piggin
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=20060313064047.GA2090@wotan.suse.de \
--to=npiggin@suse.de \
--cc=bsingharora@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nickpiggin@yahoo.com.au \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.