Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756636AbdDFG4o (ORCPT ); Thu, 6 Apr 2017 02:56:44 -0400 Received: from latin.grep.be ([46.4.76.168]:46346 "EHLO latin.grep.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755740AbdDFG4h (ORCPT ); Thu, 6 Apr 2017 02:56:37 -0400 X-Greylist: delayed 1089 seconds by postgrey-1.27 at vger.kernel.org; Thu, 06 Apr 2017 02:56:36 EDT Date: Thu, 6 Apr 2017 08:38:10 +0200 From: Wouter Verhelst To: Michal Hocko Cc: Vlastimil Babka , nbd-general@lists.sourceforge.net, Chris Leech , linux-scsi@vger.kernel.org, Josef Bacik , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, Eric Dumazet , Lee Duncan , Johannes Weiner , Andrew Morton , open-iscsi@googlegroups.com, Mel Gorman , "David S. Miller" Subject: Re: [Nbd] [PATCH 3/4] treewide: convert PF_MEMALLOC manipulations to new helpers Message-ID: <20170406063810.dmv4fg2irsqgdvyq@grep.be> References: <20170405074700.29871-1-vbabka@suse.cz> <20170405074700.29871-4-vbabka@suse.cz> <20170405113030.GL6035@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170405113030.GL6035@dhcp22.suse.cz> X-Speed: Gates' Law: Every 18 months, the speed of software halves. Organization: none User-Agent: NeoMutt/20170306 (1.8.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1550 Lines: 32 On Wed, Apr 05, 2017 at 01:30:31PM +0200, Michal Hocko wrote: > On Wed 05-04-17 09:46:59, Vlastimil Babka wrote: > > We now have memalloc_noreclaim_{save,restore} helpers for robust setting and > > clearing of PF_MEMALLOC. Let's convert the code which was using the generic > > tsk_restore_flags(). No functional change. > > It would be really great to revisit why those places outside of the mm > proper really need this flag. I know this is a painful exercise but I > wouldn't be surprised if there were abusers there. [...] > > --- > > drivers/block/nbd.c | 7 ++++--- > > drivers/scsi/iscsi_tcp.c | 7 ++++--- > > net/core/dev.c | 7 ++++--- > > net/core/sock.c | 7 ++++--- > > 4 files changed, 16 insertions(+), 12 deletions(-) These were all done to make swapping over network safe. The idea is that if a socket has SOCK_MEMALLOC set, incoming packets for that socket can access PFMEMALLOC reserves (whereas other sockets cannot); this all in the hope that one packe destined to that socket will contain the TCP ACK that confirms the swapout was successful and we can now release RAM pages for other processes. I don't know whether they need the PF_MEMALLOC flag specifically (not a kernel hacker), but they do need to interact with it at any rate. -- < ron> I mean, the main *practical* problem with C++, is there's like a dozen people in the world who think they really understand all of its rules, and pretty much all of them are just lying to themselves too. -- #debian-devel, OFTC, 2016-02-12