Skip to content

Commit 835a9a6

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
timers/migration: Rename childmask by groupmask to make naming more obvious
childmask in the group reflects the mask that is required to 'reference' this group in the parent. When reading childmask, this might be confusing, as this suggests, that this is the mask of the child of the group. Clarify this by renaming childmask in the tmigr_group and tmc_group by groupmask. Signed-off-by: Anna-Maria Behnsen <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Frederic Weisbecker <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d47be58 commit 835a9a6

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

include/trace/events/timer_migration.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ TRACE_EVENT(tmigr_connect_child_parent,
4343
__field( unsigned int, lvl )
4444
__field( unsigned int, numa_node )
4545
__field( unsigned int, num_children )
46-
__field( u32, childmask )
46+
__field( u32, groupmask )
4747
),
4848

4949
TP_fast_assign(
@@ -52,11 +52,11 @@ TRACE_EVENT(tmigr_connect_child_parent,
5252
__entry->lvl = child->parent->level;
5353
__entry->numa_node = child->parent->numa_node;
5454
__entry->num_children = child->parent->num_children;
55-
__entry->childmask = child->childmask;
55+
__entry->groupmask = child->groupmask;
5656
),
5757

58-
TP_printk("group=%p childmask=%0x parent=%p lvl=%d numa=%d num_children=%d",
59-
__entry->child, __entry->childmask, __entry->parent,
58+
TP_printk("group=%p groupmask=%0x parent=%p lvl=%d numa=%d num_children=%d",
59+
__entry->child, __entry->groupmask, __entry->parent,
6060
__entry->lvl, __entry->numa_node, __entry->num_children)
6161
);
6262

@@ -72,7 +72,7 @@ TRACE_EVENT(tmigr_connect_cpu_parent,
7272
__field( unsigned int, lvl )
7373
__field( unsigned int, numa_node )
7474
__field( unsigned int, num_children )
75-
__field( u32, childmask )
75+
__field( u32, groupmask )
7676
),
7777

7878
TP_fast_assign(
@@ -81,11 +81,11 @@ TRACE_EVENT(tmigr_connect_cpu_parent,
8181
__entry->lvl = tmc->tmgroup->level;
8282
__entry->numa_node = tmc->tmgroup->numa_node;
8383
__entry->num_children = tmc->tmgroup->num_children;
84-
__entry->childmask = tmc->childmask;
84+
__entry->groupmask = tmc->groupmask;
8585
),
8686

87-
TP_printk("cpu=%d childmask=%0x parent=%p lvl=%d numa=%d num_children=%d",
88-
__entry->cpu, __entry->childmask, __entry->parent,
87+
TP_printk("cpu=%d groupmask=%0x parent=%p lvl=%d numa=%d num_children=%d",
88+
__entry->cpu, __entry->groupmask, __entry->parent,
8989
__entry->lvl, __entry->numa_node, __entry->num_children)
9090
);
9191

kernel/time/timer_migration.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static bool tmigr_check_lonely(struct tmigr_group *group)
495495
* outcome is a CPU which might wake up a little early.
496496
* @evt: Pointer to tmigr_event which needs to be queued (of idle
497497
* child group)
498-
* @childmask: childmask of child group
498+
* @childmask: groupmask of child group
499499
* @remote: Is set, when the new timer path is executed in
500500
* tmigr_handle_remote_cpu()
501501
* @basej: timer base in jiffies
@@ -535,7 +535,7 @@ static void __walk_groups(up_f up, struct tmigr_walk *data,
535535

536536
child = group;
537537
group = group->parent;
538-
data->childmask = child->childmask;
538+
data->childmask = child->groupmask;
539539
} while (group);
540540
}
541541

@@ -669,7 +669,7 @@ static void __tmigr_cpu_activate(struct tmigr_cpu *tmc)
669669
{
670670
struct tmigr_walk data;
671671

672-
data.childmask = tmc->childmask;
672+
data.childmask = tmc->groupmask;
673673

674674
trace_tmigr_cpu_active(tmc);
675675

@@ -1049,15 +1049,15 @@ void tmigr_handle_remote(void)
10491049
if (tmigr_is_not_available(tmc))
10501050
return;
10511051

1052-
data.childmask = tmc->childmask;
1052+
data.childmask = tmc->groupmask;
10531053
data.firstexp = KTIME_MAX;
10541054

10551055
/*
10561056
* NOTE: This is a doubled check because the migrator test will be done
10571057
* in tmigr_handle_remote_up() anyway. Keep this check to speed up the
10581058
* return when nothing has to be done.
10591059
*/
1060-
if (!tmigr_check_migrator(tmc->tmgroup, tmc->childmask)) {
1060+
if (!tmigr_check_migrator(tmc->tmgroup, tmc->groupmask)) {
10611061
/*
10621062
* If this CPU was an idle migrator, make sure to clear its wakeup
10631063
* value so it won't chase timers that have already expired elsewhere.
@@ -1150,7 +1150,7 @@ bool tmigr_requires_handle_remote(void)
11501150
return ret;
11511151

11521152
data.now = get_jiffies_update(&jif);
1153-
data.childmask = tmc->childmask;
1153+
data.childmask = tmc->groupmask;
11541154
data.firstexp = KTIME_MAX;
11551155
data.tmc_active = !tmc->idle;
11561156
data.check = false;
@@ -1310,7 +1310,7 @@ static u64 __tmigr_cpu_deactivate(struct tmigr_cpu *tmc, u64 nextexp)
13101310
struct tmigr_walk data = { .nextexp = nextexp,
13111311
.firstexp = KTIME_MAX,
13121312
.evt = &tmc->cpuevt,
1313-
.childmask = tmc->childmask };
1313+
.childmask = tmc->groupmask };
13141314

13151315
/*
13161316
* If nextexp is KTIME_MAX, the CPU event will be ignored because the
@@ -1388,7 +1388,7 @@ u64 tmigr_quick_check(u64 nextevt)
13881388
if (WARN_ON_ONCE(tmc->idle))
13891389
return nextevt;
13901390

1391-
if (!tmigr_check_migrator_and_lonely(tmc->tmgroup, tmc->childmask))
1391+
if (!tmigr_check_migrator_and_lonely(tmc->tmgroup, tmc->groupmask))
13921392
return KTIME_MAX;
13931393

13941394
do {
@@ -1552,7 +1552,7 @@ static void tmigr_connect_child_parent(struct tmigr_group *child,
15521552
raw_spin_lock_nested(&parent->lock, SINGLE_DEPTH_NESTING);
15531553

15541554
child->parent = parent;
1555-
child->childmask = BIT(parent->num_children++);
1555+
child->groupmask = BIT(parent->num_children++);
15561556

15571557
raw_spin_unlock(&parent->lock);
15581558
raw_spin_unlock_irq(&child->lock);
@@ -1586,7 +1586,7 @@ static void tmigr_connect_child_parent(struct tmigr_group *child,
15861586
* the new childmask and parent to subsequent walkers through this
15871587
* @child. Therefore propagate active state unconditionally.
15881588
*/
1589-
data.childmask = child->childmask;
1589+
data.childmask = child->groupmask;
15901590

15911591
/*
15921592
* There is only one new level per time (which is protected by
@@ -1652,7 +1652,7 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)
16521652
raw_spin_lock_irq(&group->lock);
16531653

16541654
tmc->tmgroup = group;
1655-
tmc->childmask = BIT(group->num_children++);
1655+
tmc->groupmask = BIT(group->num_children++);
16561656

16571657
raw_spin_unlock_irq(&group->lock);
16581658

@@ -1731,7 +1731,7 @@ static int tmigr_cpu_prepare(unsigned int cpu)
17311731
if (ret < 0)
17321732
return ret;
17331733

1734-
if (tmc->childmask == 0)
1734+
if (tmc->groupmask == 0)
17351735
return -EINVAL;
17361736

17371737
return ret;

kernel/time/timer_migration.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ struct tmigr_event {
5151
* @num_children: Counter of group children to make sure the group is only
5252
* filled with TMIGR_CHILDREN_PER_GROUP; Required for setup
5353
* only
54-
* @childmask: childmask of the group in the parent group; is set
55-
* during setup and will never change; can be read
56-
* lockless
54+
* @groupmask: mask of the group in the parent group; is set during
55+
* setup and will never change; can be read lockless
5756
* @list: List head that is added to the per level
5857
* tmigr_level_list; is required during setup when a
5958
* new group needs to be connected to the existing
@@ -69,7 +68,7 @@ struct tmigr_group {
6968
unsigned int level;
7069
int numa_node;
7170
unsigned int num_children;
72-
u8 childmask;
71+
u8 groupmask;
7372
struct list_head list;
7473
};
7574

@@ -89,7 +88,7 @@ struct tmigr_group {
8988
* hierarchy
9089
* @remote: Is set when timers of the CPU are expired remotely
9190
* @tmgroup: Pointer to the parent group
92-
* @childmask: childmask of tmigr_cpu in the parent group
91+
* @groupmask: mask of tmigr_cpu in the parent group
9392
* @wakeup: Stores the first timer when the timer migration
9493
* hierarchy is completely idle and remote expiry was done;
9594
* is returned to timer code in the idle path and is only
@@ -102,7 +101,7 @@ struct tmigr_cpu {
102101
bool idle;
103102
bool remote;
104103
struct tmigr_group *tmgroup;
105-
u8 childmask;
104+
u8 groupmask;
106105
u64 wakeup;
107106
struct tmigr_event cpuevt;
108107
};
@@ -118,8 +117,8 @@ union tmigr_state {
118117
u32 state;
119118
/**
120119
* struct - split state of tmigr_group
121-
* @active: Contains each childmask bit of the active children
122-
* @migrator: Contains childmask of the child which is migrator
120+
* @active: Contains each mask bit of the active children
121+
* @migrator: Contains mask of the child which is migrator
123122
* @seq: Sequence counter needs to be increased when an update
124123
* to the tmigr_state is done. It prevents a race when
125124
* updates in the child groups are propagated in changed

0 commit comments

Comments
 (0)