From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752273AbdKVVMy (ORCPT ); Wed, 22 Nov 2017 16:12:54 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:48706 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751863AbdKVVIU (ORCPT ); Wed, 22 Nov 2017 16:08:20 -0500 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox Subject: [PATCH 49/62] rxrpc: Remove IDR preloading Date: Wed, 22 Nov 2017 13:07:26 -0800 Message-Id: <20171122210739.29916-50-willy@infradead.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171122210739.29916-1-willy@infradead.org> References: <20171122210739.29916-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox 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 --- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Matthew Wilcox Subject: [PATCH 49/62] rxrpc: Remove IDR preloading Date: Wed, 22 Nov 2017 13:07:26 -0800 Message-Id: <20171122210739.29916-50-willy@infradead.org> In-Reply-To: <20171122210739.29916-1-willy@infradead.org> References: <20171122210739.29916-1-willy@infradead.org> Sender: owner-linux-mm@kvack.org List-ID: From: Matthew Wilcox 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 --- 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org