Skip to content

Commit 3af8486

Browse files
urezkipaulmckrcu
authored andcommitted
rcu/tree: Simplify KFREE_BULK_MAX_ENTR macro
We can simplify KFREE_BULK_MAX_ENTR macro and get rid of magic numbers which were used to make the structure to be exactly one page. Suggested-by: Boqun Feng <[email protected]> Reviewed-by: Joel Fernandes (Google) <[email protected]> Signed-off-by: Uladzislau Rezki (Sony) <[email protected]> Signed-off-by: Joel Fernandes (Google) <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 446044e commit 3af8486

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

kernel/rcu/tree.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,13 +2958,6 @@ EXPORT_SYMBOL_GPL(call_rcu);
29582958
#define KFREE_DRAIN_JIFFIES (HZ / 50)
29592959
#define KFREE_N_BATCHES 2
29602960

2961-
/*
2962-
* This macro defines how many entries the "records" array
2963-
* will contain. It is based on the fact that the size of
2964-
* kfree_rcu_bulk_data structure becomes exactly one page.
2965-
*/
2966-
#define KFREE_BULK_MAX_ENTR ((PAGE_SIZE / sizeof(void *)) - 3)
2967-
29682961
/**
29692962
* struct kfree_rcu_bulk_data - single block to store kfree_rcu() pointers
29702963
* @nr_records: Number of active pointers in the array
@@ -2973,10 +2966,18 @@ EXPORT_SYMBOL_GPL(call_rcu);
29732966
*/
29742967
struct kfree_rcu_bulk_data {
29752968
unsigned long nr_records;
2976-
void *records[KFREE_BULK_MAX_ENTR];
29772969
struct kfree_rcu_bulk_data *next;
2970+
void *records[];
29782971
};
29792972

2973+
/*
2974+
* This macro defines how many entries the "records" array
2975+
* will contain. It is based on the fact that the size of
2976+
* kfree_rcu_bulk_data structure becomes exactly one page.
2977+
*/
2978+
#define KFREE_BULK_MAX_ENTR \
2979+
((PAGE_SIZE - sizeof(struct kfree_rcu_bulk_data)) / sizeof(void *))
2980+
29802981
/**
29812982
* struct kfree_rcu_cpu_work - single batch of kfree_rcu() requests
29822983
* @rcu_work: Let queue_rcu_work() invoke workqueue handler after grace period

0 commit comments

Comments
 (0)