/* * When maximum proportion of some event type is specified, this is the * precision with which we allow limitting. Note that this creates an upper * bound on the number of events per period like * ULLONG_MAX >> FPROP_FRAC_SHIFT.
*/ #define FPROP_FRAC_SHIFT 10 #define FPROP_FRAC_BASE (1UL << FPROP_FRAC_SHIFT)
/* * ---- Global proportion definitions ----
*/ struct fprop_global { /* Number of events in the current period */ struct percpu_counter events; /* Current period */ unsignedint period; /* Synchronization with period transitions */
seqcount_t sequence;
};
int fprop_global_init(struct fprop_global *p, gfp_t gfp); void fprop_global_destroy(struct fprop_global *p); bool fprop_new_period(struct fprop_global *p, int periods);
/* * ---- PERCPU ----
*/ struct fprop_local_percpu { /* the local events counter */ struct percpu_counter events; /* Period in which we last updated events */ unsignedint period;
raw_spinlock_t lock; /* Protect period and numerator */
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.