Search Linux Wireless

about RCU programming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I am trying to include a list o devices to poll to. I am not very
experienced but looking the current kernel code for wireless, I
thought it would be a good idea to use a linked list list_head
protected with RCU and one mutex for the add/delete parts.

I would like to receive the next device to be poll from the list every
time that someone calls the function instead of iterating the whole
list every time to find out the next device to poll. Is it possible to
use a pointer to the head and update the pointer to the next element
of the list? I mean could i do something like this?

The write side could be something like this:
mutex_lock(&sdata->u.ap.polllist_mtx);
list_add_rcu(poll_req->list, sdata->u.ap.polling_list);
mutex_unlock(&sdata->u.ap.polllist_mtx);

and the read side:
rcu_read_lock();
rcu_derreference(sdata->u.ap.polling_list->sta);
copy_sta(sdata->u.ap.polling_list->sta);
rcu_read_unlock();

sdata->u.ap.polling_list = sdata.u.ap.polling_list->next;

Do I need to use the same mutex or is this operation fast enought?

Thank you in advance!
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux