lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 22 Nov 2017 13:07:26 -0800
From:   Matthew Wilcox <willy@...radead.org>
To:     linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Cc:     Matthew Wilcox <mawilcox@...rosoft.com>
Subject: [PATCH 49/62] rxrpc: Remove IDR preloading

From: Matthew Wilcox <mawilcox@...rosoft.com>

The IDR now handles its own locking, so if we remove the locking in
rxrpc, we can also remove the memory preloading.

Signed-off-by: Matthew Wilcox <mawilcox@...rosoft.com>
---
 net/rxrpc/conn_client.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c
index 7e8bf10fec86..d61fbd359bfa 100644
--- a/net/rxrpc/conn_client.c
+++ b/net/rxrpc/conn_client.c
@@ -91,7 +91,6 @@ __read_mostly unsigned int rxrpc_conn_idle_client_fast_expiry = 2 * HZ;
 /*
  * We use machine-unique IDs for our client connections.
  */
-static DEFINE_SPINLOCK(rxrpc_conn_id_lock);
 int rxrpc_client_conn_cursor;
 DEFINE_IDR(rxrpc_client_conn_ids);
 
@@ -111,12 +110,8 @@ static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn,
 
 	_enter("");
 
-	idr_preload(gfp);
-	spin_lock(&rxrpc_conn_id_lock);
 	id = idr_alloc_cyclic(&rxrpc_client_conn_ids, &rxrpc_client_conn_cursor,
-				conn, 1, 0x40000000, GFP_NOWAIT);
-	spin_unlock(&rxrpc_conn_id_lock);
-	idr_preload_end();
+				conn, 1, 0x40000000, gfp);
 	if (id < 0)
 		goto error;
 
@@ -137,10 +132,8 @@ static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn,
 static void rxrpc_put_client_connection_id(struct rxrpc_connection *conn)
 {
 	if (test_bit(RXRPC_CONN_HAS_IDR, &conn->flags)) {
-		spin_lock(&rxrpc_conn_id_lock);
 		idr_remove(&rxrpc_client_conn_ids,
 			   conn->proto.cid >> RXRPC_CIDSHIFT);
-		spin_unlock(&rxrpc_conn_id_lock);
 	}
 }
 
-- 
2.15.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ