* spin_lock after get_cpu_var()
@ 2008-03-16 8:24 Peter Teoh
2008-03-16 10:12 ` Johannes Weiner
0 siblings, 1 reply; 2+ messages in thread
From: Peter Teoh @ 2008-03-16 8:24 UTC (permalink / raw)
To: LKML; +Cc: htmldeveloper
I find it quite puzzling (no where else in kernel source is this
found) that you would want to apply spin_lock() after get_cpu_var().
The fddef is already percpu, so there is no need to lock it, right?
I submitted this patch before, but got no response, just trying my
luck this time :-).
void free_fdtable_rcu(struct rcu_head *rcu)
{
struct fdtable *fdt = container_of(rcu, struct fdtable, rcu);
struct fdtable_defer *fddef;
BUG_ON(!fdt);
if (fdt->max_fds <= NR_OPEN_DEFAULT) {
/*
* This fdtable is embedded in the files structure and that
* structure itself is getting destroyed.
*/
kmem_cache_free(files_cachep,
container_of(fdt, struct files_struct, fdtab));
return;
}
if (fdt->max_fds <= (PAGE_SIZE / sizeof(struct file *))) {
kfree(fdt->fd);
kfree(fdt->open_fds);
kfree(fdt);
} else {
fddef = &get_cpu_var(fdtable_defer_list);=============> here
spin_lock(&fddef->lock);==========================>here
fdt->next = fddef->next;
fddef->next = fdt;
/* vmallocs are handled from the workqueue context */
schedule_work(&fddef->wq);
spin_unlock(&fddef->lock);
put_cpu_var(fdtable_defer_list);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: spin_lock after get_cpu_var()
2008-03-16 8:24 spin_lock after get_cpu_var() Peter Teoh
@ 2008-03-16 10:12 ` Johannes Weiner
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Weiner @ 2008-03-16 10:12 UTC (permalink / raw)
To: Peter Teoh; +Cc: LKML
Hi Peter,
"Peter Teoh" <htmldeveloper@gmail.com> writes:
> I find it quite puzzling (no where else in kernel source is this
> found) that you would want to apply spin_lock() after get_cpu_var().
> The fddef is already percpu, so there is no need to lock it, right?
>
> I submitted this patch before, but got no response, just trying my
> luck this time :-).
http://lkml.org/lkml/2008/3/14/208
Hannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-16 10:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-16 8:24 spin_lock after get_cpu_var() Peter Teoh
2008-03-16 10:12 ` Johannes Weiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox