* [RFC] sk_nulls_next_rcu
@ 2009-12-01 0:19 Octavian Purdila
2009-12-01 0:24 ` David Miller
2009-12-01 0:59 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 6+ messages in thread
From: Octavian Purdila @ 2009-12-01 0:19 UTC (permalink / raw)
To: netdev
I am trying to convert the LLC code to RCU, and it appears that for proc
support a sk_nulls_next_rcu would be required.
Is this the wrong way to do it, or is it that nobody need it yet?
Thanks,
tavi
diff --git a/include/net/sock.h b/include/net/sock.h
index 3f1a480..989d7e9 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -351,6 +351,13 @@ static inline struct sock *sk_nulls_next(const struct sock *sk)
NULL;
}
+static inline struct sock *sk_nulls_next_rcu(const struct sock *sk)
+{
+ struct hlist_nulls_node *n = rcu_dereference(sk->sk_nulls_node.next);
+ return !is_a_nulls(n) ? hlist_nulls_entry(n, struct sock, sk_nulls_node) :
+ NULL;
+}
+
static inline int sk_unhashed(const struct sock *sk)
{
return hlist_unhashed(&sk->sk_node);
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index be47ac4..7567fb9 100644
--- a/net/llc/llc_proc.c
+++ b/net/llc/llc_proc.c
@@ -34,19 +34,19 @@ static struct sock *llc_get_sk_idx(loff_t pos)
{
struct list_head *sap_entry;
struct llc_sap *sap;
- struct hlist_node *node;
+ struct hlist_nulls_node *node;
struct sock *sk = NULL;
list_for_each(sap_entry, &llc_sap_list) {
sap = list_entry(sap_entry, struct llc_sap, node);
- read_lock_bh(&sap->sk_list.lock);
- sk_for_each(sk, node, &sap->sk_list.list) {
+ rcu_read_lock_bh();
+ sk_nulls_for_each_rcu(sk, node, &sap->sk_list.list) {
if (!pos)
goto found;
--pos;
}
- read_unlock_bh(&sap->sk_list.lock);
+ rcu_read_unlock_bh();
}
sk = NULL;
found:
@@ -73,25 +73,25 @@ static void *llc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
goto out;
}
sk = v;
- next = sk_next(sk);
+ next = sk_nulls_next(sk);
if (next) {
sk = next;
goto out;
}
llc = llc_sk(sk);
sap = llc->sap;
- read_unlock_bh(&sap->sk_list.lock);
+ rcu_read_unlock_bh();
sk = NULL;
for (;;) {
+ struct hlist_nulls_node *node;
+
if (sap->node.next == &llc_sap_list)
break;
sap = list_entry(sap->node.next, struct llc_sap, node);
- read_lock_bh(&sap->sk_list.lock);
- if (!hlist_empty(&sap->sk_list.list)) {
- sk = sk_head(&sap->sk_list.list);
+ rcu_read_lock_bh();
+ sk_nulls_for_each_rcu(sk, node, &sap->sk_list.list)
break;
- }
- read_unlock_bh(&sap->sk_list.lock);
+ rcu_read_unlock_bh();
}
out:
return sk;
@@ -99,13 +99,8 @@ out:
static void llc_seq_stop(struct seq_file *seq, void *v)
{
- if (v && v != SEQ_START_TOKEN) {
- struct sock *sk = v;
- struct llc_sock *llc = llc_sk(sk);
- struct llc_sap *sap = llc->sap;
-
- read_unlock_bh(&sap->sk_list.lock);
- }
+ if (v && v != SEQ_START_TOKEN)
+ rcu_read_unlock_bh();
read_unlock_bh(&llc_sap_list_lock);
}
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [RFC] sk_nulls_next_rcu
2009-12-01 0:19 [RFC] sk_nulls_next_rcu Octavian Purdila
@ 2009-12-01 0:24 ` David Miller
2009-12-01 0:32 ` Octavian Purdila
2009-12-01 0:59 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2009-12-01 0:24 UTC (permalink / raw)
To: opurdila; +Cc: netdev, eric.dumazet
From: Octavian Purdila <opurdila@ixiacom.com>
Date: Tue, 1 Dec 2009 02:19:29 +0200
>
> I am trying to convert the LLC code to RCU, and it appears that for proc
> support a sk_nulls_next_rcu would be required.
>
> Is this the wrong way to do it, or is it that nobody need it yet?
I think simply nobody needed it yet.
Eric, please take a look at Octavian's patch, thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] sk_nulls_next_rcu
2009-12-01 0:24 ` David Miller
@ 2009-12-01 0:32 ` Octavian Purdila
2009-12-01 3:54 ` Eric Dumazet
0 siblings, 1 reply; 6+ messages in thread
From: Octavian Purdila @ 2009-12-01 0:32 UTC (permalink / raw)
To: David Miller; +Cc: netdev, eric.dumazet
On Tuesday 01 December 2009 02:24:54 you wrote:
> From: Octavian Purdila <opurdila@ixiacom.com>
> Date: Tue, 1 Dec 2009 02:19:29 +0200
>
> > I am trying to convert the LLC code to RCU, and it appears that for proc
> > support a sk_nulls_next_rcu would be required.
> >
> > Is this the wrong way to do it, or is it that nobody need it yet?
>
> I think simply nobody needed it yet.
>
> Eric, please take a look at Octavian's patch, thanks!
>
I will send a patch series later with several LLC enhancements, no need to
look over the LLC bits yet - its not all done yet. I'll CC Eric on the RCU
parts :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] sk_nulls_next_rcu
2009-12-01 0:32 ` Octavian Purdila
@ 2009-12-01 3:54 ` Eric Dumazet
0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2009-12-01 3:54 UTC (permalink / raw)
To: Octavian Purdila; +Cc: David Miller, netdev
Octavian Purdila a écrit :
> On Tuesday 01 December 2009 02:24:54 you wrote:
>> From: Octavian Purdila <opurdila@ixiacom.com>
>> Date: Tue, 1 Dec 2009 02:19:29 +0200
>>
>>> I am trying to convert the LLC code to RCU, and it appears that for proc
>>> support a sk_nulls_next_rcu would be required.
>>>
>>> Is this the wrong way to do it, or is it that nobody need it yet?
>> I think simply nobody needed it yet.
>>
>> Eric, please take a look at Octavian's patch, thanks!
>>
>
> I will send a patch series later with several LLC enhancements, no need to
> look over the LLC bits yet - its not all done yet. I'll CC Eric on the RCU
> parts :)
No problem I'll review your patches
Thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] sk_nulls_next_rcu
2009-12-01 0:19 [RFC] sk_nulls_next_rcu Octavian Purdila
2009-12-01 0:24 ` David Miller
@ 2009-12-01 0:59 ` Arnaldo Carvalho de Melo
2009-12-03 22:47 ` Octavian Purdila
1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-12-01 0:59 UTC (permalink / raw)
To: Octavian Purdila; +Cc: netdev
Em Tue, Dec 01, 2009 at 02:19:29AM +0200, Octavian Purdila escreveu:
>
> I am trying to convert the LLC code to RCU, and it appears that for proc
> support a sk_nulls_next_rcu would be required.
I find it amusing, and give you a carte blanche on that! :-)
- Arnaldo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] sk_nulls_next_rcu
2009-12-01 0:59 ` Arnaldo Carvalho de Melo
@ 2009-12-03 22:47 ` Octavian Purdila
0 siblings, 0 replies; 6+ messages in thread
From: Octavian Purdila @ 2009-12-03 22:47 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: netdev
On Tuesday 01 December 2009 02:59:29 you wrote:
> Em Tue, Dec 01, 2009 at 02:19:29AM +0200, Octavian Purdila escreveu:
> > I am trying to convert the LLC code to RCU, and it appears that for proc
> > support a sk_nulls_next_rcu would be required.
>
> I find it amusing, and give you a carte blanche on that! :-)
>
:-) Its just an exercise for me to understand RCU, but its harder than I
originally thought and I did give up trying to finish it in the first batch of
LLC patches I've just sent.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-12-03 22:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-01 0:19 [RFC] sk_nulls_next_rcu Octavian Purdila
2009-12-01 0:24 ` David Miller
2009-12-01 0:32 ` Octavian Purdila
2009-12-01 3:54 ` Eric Dumazet
2009-12-01 0:59 ` Arnaldo Carvalho de Melo
2009-12-03 22:47 ` Octavian Purdila
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).