1
0
mirror of https://github.com/0xAX/linux-insides.git synced 2024-12-22 14:48:08 +00:00

Merge pull request #765 from Mutated1994/patch-9

Update linux-timers-2.md
This commit is contained in:
Sebastian Fricke 2020-12-20 11:53:36 +01:00 committed by GitHub
commit ff53caa2da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,14 +304,20 @@ Note that before the first will be called, we lock the `clocksource_mutex` [mute
The first `clocksource_enqueue` function and other two defined in the same source code [file](https://github.com/torvalds/linux/tree/master/kernel/time/clocksource.c). We go through all already registered `clocksources` or in other words we go through all elements of the `clocksource_list` and tries to find best place for a given `clocksource`: The first `clocksource_enqueue` function and other two defined in the same source code [file](https://github.com/torvalds/linux/tree/master/kernel/time/clocksource.c). We go through all already registered `clocksources` or in other words we go through all elements of the `clocksource_list` and tries to find best place for a given `clocksource`:
```C ```C
/*
* Enqueue the clocksource sorted by rating
*/
static void clocksource_enqueue(struct clocksource *cs) static void clocksource_enqueue(struct clocksource *cs)
{ {
struct list_head *entry = &clocksource_list; struct list_head *entry = &clocksource_list;
struct clocksource *tmp; struct clocksource *tmp;
list_for_each_entry(tmp, &clocksource_list, list) list_for_each_entry(tmp, &clocksource_list, list) {
if (tmp->rating >= cs->rating) /* Keep track of the place, where to insert */
entry = &tmp->list; if (tmp->rating < cs->rating)
break;
entry = &tmp->list;
}
list_add(&cs->list, entry); list_add(&cs->list, entry);
} }
``` ```