Changeset cf447b9 in rtems-libbsd


Ignore:
Timestamp:
09/14/18 11:46:50 (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, 5-freebsd-12, 6-freebsd-12, master
Children:
a85d900
Parents:
08fbf18
git-author:
Sebastian Huber <sebastian.huber@…> (09/14/18 11:46:50)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/17/18 07:10:52)
Message:

Remove struct callout::c_cpu

This is an optimization of the callout handling. In libbsd all callouts
are handled by the one and only timer server.

Location:
freebsd/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/kern/kern_timeout.c

    r08fbf18 rcf447b9  
    224224#define CC_LOCK_ASSERT(cc)      mtx_assert(&(cc)->cc_lock, MA_OWNED)
    225225
     226#ifndef __rtems__
    226227static int timeout_cpu;
     228#else /* __rtems__ */
     229#define timeout_cpu 0
     230#endif /* __rtems__ */
    227231
    228232static void     callout_cpu_init(struct callout_cpu *cc, int cpu);
     
    373377         * be removed.
    374378         */
     379#ifndef __rtems__
    375380        timeout_cpu = PCPU_GET(cpuid);
     381#endif /* __rtems__ */
    376382        cc = CC_CPU(timeout_cpu);
    377383        cc->cc_callout = malloc(ncallout * sizeof(struct callout),
     
    654660{
    655661        struct callout_cpu *cc;
     662#ifndef __rtems__
    656663        int cpu;
    657664
     
    665672                }
    666673#endif
     674#endif /* __rtems__ */
    667675                cc = CC_CPU(cpu);
    668676                CC_LOCK(cc);
     677#ifndef __rtems__
    669678                if (cpu == c->c_cpu)
    670679                        break;
    671680                CC_UNLOCK(cc);
    672681        }
     682#endif /* __rtems__ */
    673683        return (cc);
    674684}
     
    11301140#ifndef __rtems__
    11311141        int cancelled, direct;
     1142        int ignore_cpu=0;
    11321143#else /* __rtems__ */
    11331144        int cancelled;
    11341145#endif /* __rtems__ */
    1135         int ignore_cpu=0;
    11361146
    11371147        cancelled = 0;
     1148#ifndef __rtems__
    11381149        if (cpu == -1) {
    11391150                ignore_cpu = 1;
     
    11431154                panic("Invalid CPU in callout %d", cpu);
    11441155        }
     1156#endif /* __rtems__ */
    11451157        callout_when(sbt, prec, flags, &to_sbt, &precision);
    11461158
     
    11601172#endif /* __rtems__ */
    11611173        cc = callout_lock(c);
     1174#ifndef __rtems__
    11621175        /*
    11631176         * Don't allow migration of pre-allocated callouts lest they
     
    11691182                cpu = c->c_cpu;
    11701183        }
     1184#endif /* __rtems__ */
    11711185
    11721186        if (cc_exec_curr(cc, direct) == c) {
     
    12891303callout_schedule(struct callout *c, int to_ticks)
    12901304{
     1305#ifndef __rtems__
    12911306        return callout_reset_on(c, to_ticks, c->c_func, c->c_arg, c->c_cpu);
     1307#else /* __rtems__ */
     1308        return callout_reset_on(c, to_ticks, c->c_func, c->c_arg, 0);
     1309#endif /* __rtems__ */
    12921310}
    12931311
     
    15951613                c->c_iflags = 0;
    15961614        }
     1615#ifndef __rtems__
    15971616        c->c_cpu = timeout_cpu;
     1617#endif /* __rtems__ */
    15981618}
    15991619
     
    16111631            __func__));
    16121632        c->c_iflags = flags & (CALLOUT_RETURNUNLOCKED | CALLOUT_SHAREDLOCK);
     1633#ifndef __rtems__
    16131634        c->c_cpu = timeout_cpu;
     1635#endif /* __rtems__ */
    16141636}
    16151637
  • freebsd/sys/sys/_callout.h

    r08fbf18 rcf447b9  
    6060        short   c_flags;                        /* User State */
    6161        short   c_iflags;                       /* Internal State */
     62#ifndef __rtems__
    6263        volatile int c_cpu;                     /* CPU we're scheduled on */
     64#endif /* __rtems__ */
    6365};
    6466
Note: See TracChangeset for help on using the changeset viewer.