Re: [PATCH tip/core/rcu 14/15] rcu/tree: Allocate a page when caller is preemptible

From: Michal Hocko
Date: Fri Oct 02 2020 - 02:57:51 EST


On Thu 01-10-20 09:27:09, Paul E. McKenney wrote:
[...]
> commit ea5c19d21233b5e8d3d06c0d4ecd6be9f2829dc3
> Author: Paul E. McKenney <paulmck@xxxxxxxxxx>
> Date: Thu Oct 1 09:24:40 2020 -0700
>
> kvfree_rcu: Use __GFP_NOMEMALLOC for single-argument kvfree_rcu()
>
> This commit applies the __GFP_NOMEMALLOC gfp flag to memory allocations
> carried out by the single-argument variant of kvfree_rcu(), thus avoiding
> this can-sleep code path from dipping into the emergency reserves.
>
> Suggested-by: Michal Hocko <mhocko@xxxxxxxx>
> Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>

LGTM. At least for this one I feel competent to give you
Acked-by: Michal Hocko <mhocko@xxxxxxxx>

>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 242f0f0..6132452 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3364,7 +3364,8 @@ add_ptr_to_bulk_krc_lock(struct kfree_rcu_cpu **krcp,
> {
> struct kvfree_rcu_bulk_data *bnode;
> bool can_alloc_page = preemptible();
> - gfp_t gfp = (can_sleep ? GFP_KERNEL | __GFP_RETRY_MAYFAIL : GFP_ATOMIC) | __GFP_NOWARN;
> + gfp_t gfp = (can_sleep ? GFP_KERNEL | __GFP_RETRY_MAYFAIL | __GFP_NOMEMALLOC
> + : GFP_ATOMIC) | __GFP_NOWARN;
> int idx;
>
> *krcp = krc_this_cpu_lock(flags);

--
Michal Hocko
SUSE Labs