Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756176AbbFCOoq (ORCPT ); Wed, 3 Jun 2015 10:44:46 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:37800 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755422AbbFCOoO (ORCPT ); Wed, 3 Jun 2015 10:44:14 -0400 From: Jeff Layton X-Google-Original-From: Jeff Layton To: Trond Myklebust Cc: linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mel Gorman , Jerome Marchand , Chuck Lever Subject: [PATCH v2 3/5] sunrpc: if we're closing down a socket, clear memalloc on it first Date: Wed, 3 Jun 2015 10:43:50 -0400 Message-Id: <1433342632-16173-4-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1433342632-16173-1-git-send-email-jeff.layton@primarydata.com> References: <1433342632-16173-1-git-send-email-jeff.layton@primarydata.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1226 Lines: 36 We currently increment the memalloc_socks counter if we have a xprt that is associated with a swapfile. That socket can be replaced however during a reconnect event, and the memalloc_socks counter is never decremented if that occurs. When tearing down a xprt socket, check to see if the xprt is set up for swapping and sk_clear_memalloc before releasing the socket if so. Acked-by: Mel Gorman Signed-off-by: Jeff Layton --- net/sunrpc/xprtsock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index a2861bbfd319..359446442112 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -827,6 +827,9 @@ static void xs_reset_transport(struct sock_xprt *transport) if (sk == NULL) return; + if (atomic_read(&transport->xprt.swapper)) + sk_clear_memalloc(sk); + write_lock_bh(&sk->sk_callback_lock); transport->inet = NULL; transport->sock = NULL; -- 2.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/