From 8fb044e2d63514c987fe01d56cdd48b0c7446a83 Mon Sep 17 00:00:00 2001 From: Tony Truong Date: Mon, 28 Nov 2022 16:19:16 -0800 Subject: [PATCH] net: qrtr: Change port insertion to atomic The xa_insert function cannot be called with GFP_ATOMIC if the context does not have preemption disabled. There was a change to make the port insertion structure synchronize with rcu and therefore was no longer protected with spinlocks. Using RCUs lead to a performance degredation so spinlock synchronization was reinstated. Now that port insertion happens within a spinlock, GFP_KERNEL cannot be used. Change-Id: Ib09addbcaa7802bf80ddb953901e07e43c0f376e Signed-off-by: Tony Truong --- net/qrtr/af_qrtr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index ced6ec7b4f4b..fbcfd378c76b 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -1577,9 +1577,9 @@ static int qrtr_port_assign(struct qrtr_sock *ipc, int *port) in_egroup_p(GLOBAL_ROOT_GID))) { rc = -EACCES; } else if (*port == QRTR_PORT_CTRL) { - rc = xa_insert(&qrtr_ports, 0, ipc, GFP_KERNEL); + rc = xa_insert(&qrtr_ports, 0, ipc, GFP_ATOMIC); } else { - rc = xa_insert(&qrtr_ports, *port, ipc, GFP_KERNEL); + rc = xa_insert(&qrtr_ports, *port, ipc, GFP_ATOMIC); } if (rc == -EBUSY)