]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/mlx5: E-Switch, let esw work callers choose GFP flags
authorMark Bloch <mbloch@nvidia.com>
Sun, 3 May 2026 20:27:21 +0000 (23:27 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 7 May 2026 02:03:37 +0000 (19:03 -0700)
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 <mbloch@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260503202726.266415-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

index 69ddf56e2fc946ae6ddc65167a4402fb4600427b..69134ce2a908186c2345be6095caafecc115770b 100644 (file)
@@ -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;