net: qrtr: Change port allocation to atomic

The xa_alloc_cyclic function cannot be called with GFP_ATOMIC if the
context does not have preemption disabled. There was a change to make
the port allocation 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
allocation happens within a spinlock, GFP_KERNEL cannot be used.

Change-Id: I2178e190a73a949423d7c7ece1af92ab173e176d
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
This commit is contained in:
Chris Lew 2022-03-30 13:38:48 -07:00 committed by Gerrit - the friendly Code Review server
parent 0909e0e1ee
commit 8e0779d502

View File

@ -1472,7 +1472,7 @@ static int qrtr_port_assign(struct qrtr_sock *ipc, int *port)
if (!*port) {
rc = xa_alloc_cyclic(&qrtr_ports, port, ipc,
QRTR_EPH_PORT_RANGE, &qrtr_ports_next,
GFP_KERNEL);
GFP_ATOMIC);
} else if (*port < QRTR_MIN_EPH_SOCKET &&
!(capable(CAP_NET_ADMIN) ||
in_egroup_p(AID_VENDOR_QRTR) ||