* [lttng-dev] cds_lfht_count_nodes always returns -1 for before/after counts
@ 2015-04-25 21:29 Jeff Layton
2015-04-25 23:32 ` Jeff Layton
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2015-04-25 21:29 UTC (permalink / raw)
Hi, I have some code using the cds_lfht infrastructure, and recently
added a function to check to see if the table was empty using
cds_lfht_count_nodes. That function just does this:
rcu_read_lock();
cds_lfht_count_nodes(ht, &before, &count, &after);
rcu_read_unlock();
What I've found though is that when the table is empty and I know that
there are no concurrent inserts going on, the before and after counters
are always set to -1 after this call.
Is that expected behavior? For the record, I'm using this package from
the Fedora 21 repos:
userspace-rcu-0.8.1-5.fc21.x86_64
Thanks in advance!
--
Jeff Layton <jlayton at poochiereds.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [lttng-dev] cds_lfht_count_nodes always returns -1 for before/after counts
2015-04-25 21:29 [lttng-dev] cds_lfht_count_nodes always returns -1 for before/after counts Jeff Layton
@ 2015-04-25 23:32 ` Jeff Layton
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2015-04-25 23:32 UTC (permalink / raw)
On Sat, 25 Apr 2015 17:29:02 -0400
Jeff Layton <jlayton at poochiereds.net> wrote:
> Hi, I have some code using the cds_lfht infrastructure, and recently
> added a function to check to see if the table was empty using
> cds_lfht_count_nodes. That function just does this:
>
> rcu_read_lock();
> cds_lfht_count_nodes(ht, &before, &count, &after);
> rcu_read_unlock();
>
> What I've found though is that when the table is empty and I know that
> there are no concurrent inserts going on, the before and after counters
> are always set to -1 after this call.
>
> Is that expected behavior? For the record, I'm using this package from
> the Fedora 21 repos:
>
> userspace-rcu-0.8.1-5.fc21.x86_64
>
> Thanks in advance!
Nevermind...I figured out my bug. I had thought it was safe to call
cds_lfht_del on a node that had never been inserted, but it's clearly
not and that throws off the add/del counts.
Sorry for the noise!
--
Jeff Layton <jlayton at poochiereds.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-25 23:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-25 21:29 [lttng-dev] cds_lfht_count_nodes always returns -1 for before/after counts Jeff Layton
2015-04-25 23:32 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox