Messages in this thread | | | Date | Fri, 5 Aug 2005 08:46:23 +0200 | From | Jens Axboe <> | Subject | Re: [ck] [PATCH] Timer Top was: i386 No-Idle-Hz aka Dynamic-Ticks 3 |
| |
On Thu, Aug 04 2005, Daniel Petrini wrote: > +static LIST_HEAD(timer_list); > + > +struct timer_top_info { > + unsigned int func_pointer; > + unsigned int long counter; > + struct list_head list; > +}; > + > +struct timer_top_info top_info; > + > +int account_timer(unsigned int function, struct timer_top_info * top_info) > +{ > + struct timer_top_info *top; > + > + list_for_each_entry (top, &timer_list, list) { > + /* if it is in the list increment its count */ > + if (top->func_pointer == function) { > + top->counter += 1; > + return 0; > + } > + }
What protects this list?
> + > + /* if you are here then it didnt find so inserts in the list */ > + > + top = kmalloc(sizeof(struct timer_top_info), GFP_KERNEL); > + if (!top) > + return -ENOMEM;
You can't use GFP_KERNEL here, you are inside the timer base lock.
-- Jens Axboe
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |