Re: [ck] [PATCH] Timer Top was: i386 No-Idle-Hz aka Dynamic-Ticks 3

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

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux