From patchwork Thu May 10 17:17:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 158348 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DBE28B6FA2 for ; Fri, 11 May 2012 03:17:39 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756049Ab2EJRRY (ORCPT ); Thu, 10 May 2012 13:17:24 -0400 Received: from sabe.cs.wisc.edu ([128.105.6.20]:52545 "EHLO sabe.cs.wisc.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755209Ab2EJRRW (ORCPT ); Thu, 10 May 2012 13:17:22 -0400 Received: from [20.15.0.22] (c-24-118-21-114.hsd1.mn.comcast.net [24.118.21.114]) (authenticated bits=0) by sabe.cs.wisc.edu (8.14.1/8.14.1) with ESMTP id q4AHH7pu011336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 10 May 2012 12:17:08 -0500 Message-ID: <4FABF80D.3040803@cs.wisc.edu> Date: Thu, 10 May 2012 12:17:01 -0500 From: Mike Christie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Mel Gorman CC: Andrew Morton , Linux-MM , Linux-Netdev , LKML , David Miller , Neil Brown , Peter Zijlstra , Eric B Munson Subject: Re: [PATCH 00/17] Swap-over-NBD without deadlocking V10 References: <1336657510-24378-1-git-send-email-mgorman@suse.de> In-Reply-To: <1336657510-24378-1-git-send-email-mgorman@suse.de> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 05/10/2012 08:44 AM, Mel Gorman wrote: > When a user or administrator requires swap for their application, they > create a swap partition and file, format it with mkswap and activate it > with swapon. Swap over the network is considered as an option in diskless > systems. The two likely scenarios are when blade servers are used as part > of a cluster where the form factor or maintenance costs do not allow the > use of disks and thin clients. Thank you for working on this. I made the attached patch for software iscsi which has the same issue as nbd. I tested the patch here and did not notice any performance regressions or any other bugs. From 917d53f16d1e26b12e90e5e15df76a7a8bee35e8 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Thu, 3 May 2012 12:36:18 -0500 Subject: [PATCH 1/1] iscsi: Set SOCK_MEMALLOC for access to PFMEMALLOC reserves Set SOCK_MEMALLOC on the iscsi socket to allow access to PFMEMALLOC reserves to prevent deadlock. Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 453a740..7360f4c 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -370,17 +370,24 @@ static inline int iscsi_sw_tcp_xmit_qlen(struct iscsi_conn *conn) static int iscsi_sw_tcp_pdu_xmit(struct iscsi_task *task) { struct iscsi_conn *conn = task->conn; - int rc; + unsigned long pflags = current->flags; + int rc = 0; + + current->flags |= PF_MEMALLOC; while (iscsi_sw_tcp_xmit_qlen(conn)) { rc = iscsi_sw_tcp_xmit(conn); - if (rc == 0) - return -EAGAIN; + if (rc == 0) { + rc = -EAGAIN; + break; + } if (rc < 0) - return rc; + break; + rc = 0; } - return 0; + tsk_restore_flags(current, pflags, PF_MEMALLOC); + return rc; } /* @@ -665,6 +672,7 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, sk->sk_reuse = 1; sk->sk_sndtimeo = 15 * HZ; /* FIXME: make it configurable */ sk->sk_allocation = GFP_ATOMIC; + sk_set_memalloc(sk); iscsi_sw_tcp_conn_set_callbacks(conn); tcp_sw_conn->sendpage = tcp_sw_conn->sock->ops->sendpage;