Re: Why no trylock for read/write_bh?

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

 



On Tue, Mar 31, 2009 at 4:00 PM,  <kristrev@xxxxxxxxx> wrote:
>> sounds like u need a mutex or semaphore lock.   not the spinlock type,
>> nevertheless, pick your choice:
>>
>> c06f5040 T _read_trylock
>> c06f5028 T _spin_trylock
>> c06f5154 T _spin_trylock_bh
>> c06f5061 T _write_trylock
>> c0444958 T down_read_trylock
>> c0444ec4 T down_trylock
>> c0444978 T down_write_trylock
>> c06f4096 T mutex_trylock
>> c044e86e t rt_mutex_slowtrylock
>> c06f4844 T rt_mutex_trylock
>> c067ccc2 T rtnl_trylock
>
> Thank you, I will look into those.
>
>>
>> but sorry, why "proc-variable" need bh-kind of lock?
>
> When reading/writing to a proc-variable, a softirq is triggered. And since

any specific scenario where this can happened?   as far as i know,
procfs is just a filesystem, and when u read/write to it, it gets
treated as a filesystem operation:   fs/proc/:

http://www.faqs.org/docs/kernel/x716.html
http://ww2.cs.fsu.edu/~rosentha/linux/2.6.26.5/docs/DocBook/procfs-guide/index.html
http://linuxgazette.net/115/nirendra.html
http://en.wikipedia.org/wiki/Procfs

whereas softirq are handled via a kernel thread: ksoftirqd.   correctly?

As for executing procfs operation inside the ksoftirqd context, I am
not sure if it will happen or not, or what will happen if procfs
operation is executed.  (by operations I meant for example:
fs/proc/base.c:

base.c:static const struct file_operations proc_lstats_operations = {
base.c:static const struct file_operations proc_mounts_operations = {
base.c:static const struct file_operations proc_mountinfo_operations = {
base.c:static const struct file_operations proc_mountstats_operations = {
base.c:static const struct file_operations proc_info_file_operations = {
base.c:static const struct file_operations proc_single_file_operations = {
base.c:static const struct file_operations proc_mem_operations = {
base.c:static const struct file_operations proc_environ_operations = {
base.c:static const struct file_operations proc_oom_adjust_operations = {
base.c:static const struct file_operations proc_loginuid_operations = {
base.c:static const struct file_operations proc_sessionid_operations = {
base.c:static const struct file_operations proc_fault_inject_operations = {
base.c:static const struct file_operations proc_pid_sched_operations = {
base.c:static const struct file_operations proc_fdinfo_file_operations = {
base.c:static const struct file_operations proc_fd_operations = {

??????

> the read/write-functions of my proc variable is accsessing a shared value,
> I need to have locks that disable softirqs for the time being.
>
> -Kristian
>
>



-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux