From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from latin.grep.be ([46.4.76.168]:42917 "EHLO latin.grep.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756256AbdDFGi2 (ORCPT ); Thu, 6 Apr 2017 02:38:28 -0400 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 In-Reply-To: <20170405113030.GL6035@dhcp22.suse.cz> Sender: linux-block-owner@vger.kernel.org List-Id: linux-block@vger.kernel.org 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