lkml.org 
[lkml]   [2005]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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/

    \
     
     \ /
      Last update: 2005-08-05 08:51    [W:0.021 / U:31.136 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site