Re: [PATCH tip/core/rcu 1/2] rcu: Support kfree_bulk() interface in kfree_rcu()

Uladzislau Rezki
2020-02-24T16:11:51Z

> >
> > +/*
> > + * This macro defines how many entries the "records" array
> > + * will contain. It is based on the fact that the size of
> > + * kfree_rcu_bulk_data structure becomes exactly one page.
> > + */
> > +#define KFREE_BULK_MAX_ENTR ((PAGE_SIZE / sizeof(void *)) - 3)
> > +
>
> Why use the "magic" number "3" here? Could we just define struct
> kfree_rcu_bulk_data as:
>
> struct kfree_rcu_bulk_data {
> struct kfree_rcu_bulk_data *next;
> struct rcu_head *head_free_debug;
> unsigned long nr_records;
> void *records[];
> }
>
> ?
>
> And the the above macro becomes:
>
> #define KFREE_BULK_MAX_ENTR ((PAGE_SIZE - sizeof(struct kfree_rcu_bulk_data)) / sizeof(void *))
>
That should work. I agree that looks better :)

We can fix that by submitting a separate patch.

Thank you!

--
Vlad Rezki