Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6397

Periodically calling a function since system initialization

$
0
0

Assume I have a per-CPU variable declared with DEFINE_PER_CPU(struct var, var) and associated to each struct var is an attribute int count. This occurs during system initialization and is therefore (assumedly) located in init/main.c. Further assume that I have an increment_count() function defined as

    void increment_count() {        per_cpu(var, get_cpu()).count += 1;        put_cpu();    }

I would like for increment_count to get called by the kernel every x milliseconds, beginning at system initialization. Some jitter in the timing interval is fine. How can this be implemented in practice? Furthermore, do I need to explicitly preempt the currently running thread to allow the increment_count() thread to run?


Viewing all articles
Browse latest Browse all 6397

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>