File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -399,14 +399,20 @@ struct damon_ctx {
399
399
struct list_head schemes ;
400
400
};
401
401
402
- #define damon_next_region (r ) \
403
- (container_of(r->list.next, struct damon_region, list))
402
+ static inline struct damon_region * damon_next_region (struct damon_region * r )
403
+ {
404
+ return container_of (r -> list .next , struct damon_region , list );
405
+ }
404
406
405
- #define damon_prev_region (r ) \
406
- (container_of(r->list.prev, struct damon_region, list))
407
+ static inline struct damon_region * damon_prev_region (struct damon_region * r )
408
+ {
409
+ return container_of (r -> list .prev , struct damon_region , list );
410
+ }
407
411
408
- #define damon_last_region (t ) \
409
- (list_last_entry(&t->regions_list, struct damon_region, list))
412
+ static inline struct damon_region * damon_last_region (struct damon_target * t )
413
+ {
414
+ return list_last_entry (& t -> regions_list , struct damon_region , list );
415
+ }
410
416
411
417
#define damon_for_each_region (r , t ) \
412
418
list_for_each_entry(r, &t->regions_list, list)
Original file line number Diff line number Diff line change @@ -729,7 +729,10 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
729
729
}
730
730
}
731
731
732
- #define sz_damon_region (r ) (r->ar.end - r->ar.start)
732
+ static inline unsigned long sz_damon_region (struct damon_region * r )
733
+ {
734
+ return r -> ar .end - r -> ar .start ;
735
+ }
733
736
734
737
/*
735
738
* Merge two adjacent regions into one region
Original file line number Diff line number Diff line change 26
26
* 't->id' should be the pointer to the relevant 'struct pid' having reference
27
27
* count. Caller must put the returned task, unless it is NULL.
28
28
*/
29
- #define damon_get_task_struct (t ) \
30
- (get_pid_task((struct pid *)t->id, PIDTYPE_PID))
29
+ static inline struct task_struct * damon_get_task_struct (struct damon_target * t )
30
+ {
31
+ return get_pid_task ((struct pid * )t -> id , PIDTYPE_PID );
32
+ }
31
33
32
34
/*
33
35
* Get the mm_struct of the given target
You can’t perform that action at this time.
0 commit comments