Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755794AbbFCOoS (ORCPT ); Wed, 3 Jun 2015 10:44:18 -0400 Received: from mail-wg0-f47.google.com ([74.125.82.47]:33102 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754414AbbFCOoG (ORCPT ); Wed, 3 Jun 2015 10:44:06 -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 0/5] sunrpc: clean up "swapper" xprt handling Date: Wed, 3 Jun 2015 10:43:47 -0400 Message-Id: <1433342632-16173-1-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2351 Lines: 52 v2: - don't take xprt lock unless we need to manipulate the memalloc flag - add new xprt operations for swap enable/disable This series is a (small) overhaul of the swap-over-NFS code. The main impetus is to fix the problem reported by Jerome Marchand. We currently hold the rcu_read_lock when calling xs_swapper and that's just plain wrong. The first patch in this series should fix that problem, and also clean up a bit of a layering violation. The other focus of this set is to change how the swapper refcounting works. Right now, it's only tracked in the rpc_xprt, and there seem to be some gaps in its coverage -- places where we should taking or dropping references but aren't. This changes it so that the clnt tracks the number of swapfiles that it has, and the xprt tracks the number of "swappable" clients. It also ensures that we only call sk_set_memalloc once per socket. I believe that's the correct thing to do as the main reason for the memalloc_socks counter is to track whether we have _any_ memalloc-enabled sockets. There is still some work to be done here as I think there remains some potential for races between swapon/swapoff, and reconnect or migration events. That will take some careful thought that I haven't the time to spend on at the moment. I don't think this set will make those races any worse though. Jeff Layton (5): sunrpc: keep a count of swapfiles associated with the rpc_clnt sunrpc: make xprt->swapper an atomic_t sunrpc: if we're closing down a socket, clear memalloc on it first sunrpc: lock xprt before trying to set memalloc on the sockets sunrpc: turn swapper_enable/disable functions into rpc_xprt_ops fs/nfs/file.c | 11 +----- include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/sched.h | 16 ++++++++ include/linux/sunrpc/xprt.h | 17 ++++++++- net/sunrpc/clnt.c | 67 +++++++++++++++++++++++++++----- net/sunrpc/xprtrdma/transport.c | 15 +++++++- net/sunrpc/xprtsock.c | 84 +++++++++++++++++++++++++++++++++-------- 7 files changed, 174 insertions(+), 37 deletions(-) -- 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/