From: Mark Bloch Date: Sun, 3 May 2026 20:27:21 +0000 (+0300) Subject: net/mlx5: E-Switch, let esw work callers choose GFP flags X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=386ef557f6df1955631d2b0d79c5984e1b1ce145;p=thirdparty%2Flinux.git net/mlx5: E-Switch, let esw work callers choose GFP flags mlx5_esw_add_work() always allocates the queued work item with GFP_ATOMIC. That is required for the E-Switch functions-change notifier, but not every caller of this helper will run from atomic context. Pass an allocation flag to mlx5_esw_add_work() and keep the notifier caller using GFP_ATOMIC. This allows sleepable callers to use GFP_KERNEL instead of unnecessarily relying on atomic reserves. Signed-off-by: Mark Bloch Signed-off-by: Tariq Toukan Link: https://patch.msgid.link/20260503202726.266415-3-tariqt@nvidia.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 69ddf56e2fc9..69134ce2a908 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -3736,11 +3736,12 @@ free: } static int mlx5_esw_add_work(struct mlx5_eswitch *esw, - void (*func)(struct mlx5_eswitch *esw)) + void (*func)(struct mlx5_eswitch *esw), + gfp_t gfp) { struct mlx5_host_work *host_work; - host_work = kzalloc_obj(*host_work, GFP_ATOMIC); + host_work = kzalloc_obj(*host_work, gfp); if (!host_work) return -ENOMEM; @@ -3764,7 +3765,8 @@ int mlx5_esw_funcs_changed_handler(struct notifier_block *nb, esw_funcs = mlx5_nb_cof(nb, struct mlx5_esw_functions, nb); esw = container_of(esw_funcs, struct mlx5_eswitch, esw_funcs); - ret = mlx5_esw_add_work(esw, esw_vfs_changed_event_handler); + ret = mlx5_esw_add_work(esw, esw_vfs_changed_event_handler, + GFP_ATOMIC); if (ret) return NOTIFY_DONE;