Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756915Ab2EOJrd (ORCPT ); Tue, 15 May 2012 05:47:33 -0400 Received: from merlin.infradead.org ([205.233.59.134]:46693 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755934Ab2EOJrc convert rfc822-to-8bit (ORCPT ); Tue, 15 May 2012 05:47:32 -0400 Message-ID: <1337075234.27694.9.camel@twins> Subject: Re: [PATCH 01/12] netvm: Prevent a stream-specific deadlock From: Peter Zijlstra To: Mel Gorman Cc: David Miller , akpm@linux-foundation.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Trond.Myklebust@netapp.com, neilb@suse.de, hch@infradead.org, michaelc@cs.wisc.edu, emunson@mgebm.net Date: Tue, 15 May 2012 11:47:14 +0200 In-Reply-To: <20120515091402.GG29102@suse.de> References: <1336658065-24851-2-git-send-email-mgorman@suse.de> <20120511.011034.557833140906762226.davem@davemloft.net> <20120514105604.GB29102@suse.de> <20120514.162634.1094732813264319951.davem@davemloft.net> <20120515091402.GG29102@suse.de> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1142 Lines: 26 On Tue, 2012-05-15 at 10:14 +0100, Mel Gorman wrote: > @@ -289,6 +289,18 @@ void sk_clear_memalloc(struct sock *sk) > sock_reset_flag(sk, SOCK_MEMALLOC); > sk->sk_allocation &= ~__GFP_MEMALLOC; > static_key_slow_dec(&memalloc_socks); > + > + /* > + * SOCK_MEMALLOC is allowed to ignore rmem limits to ensure forward > + * progress of swapping. However, if SOCK_MEMALLOC is cleared while > + * it has rmem allocations there is a risk that the user of the > + * socket cannot make forward progress due to exceeding the rmem > + * limits. By rights, sk_clear_memalloc() should only be called > + * on sockets being torn down but warn and reset the accounting if > + * that assumption breaks. > + */ > + if (WARN_ON(sk->sk_forward_alloc)) WARN_ON_ONCE() perhaps? > + sk_mem_reclaim(sk); > } -- 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/