Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3620183ybi; Mon, 29 Jul 2019 09:36:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcsJriuiK6A1afaBlUmfzKKVSX/HCsT3su87cx8lEOHQNmNDlRXXKuV598Bqh5Ie9X4spA X-Received: by 2002:a17:902:24e:: with SMTP id 72mr68245381plc.65.1564418180349; Mon, 29 Jul 2019 09:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564418180; cv=none; d=google.com; s=arc-20160816; b=0x7FqnH3Y03m6UnZqayeMerNERPXrac1XX9/LycbjDaVZNNoKkD4k7xJb6kiX2p65S 9RrGR66eY7hsDBuxZBWMPanUeYZmrvJfyiiqjeUM7FANlH6vsf3XE7auRmiSKU/vGr/0 QawRP46U5SXMTP6a1Q2n1lBmcx8AhyJaBpZBUQKujeuodmrChWkJncUbXnUyfvZ09/w8 HiQ2FOV7EVesXvmcseaSyaAD4L2fTteK+HYDBMjiay3UPqaVKkSqa9gbwbbgsApPWRZC I0zE+/i3LKjTaARmdD6JO+54ty3YTuLkUpJXvyGF/jMyuFdNdZARxKNA4c9Ww1XUd09I OBFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uUW0YKHPLieEQydyNjaqE+DPJSP/Cf4fqcZtPwBzjUQ=; b=ii6g3xj1dzo+YcRgv4oBdzUhckg+qaC6xJxbFerCzZP33GNQ72CNucpUnSGPuqfcaT ADnQsIO4aDY571D8TbNpqfALiR4HiBklW0u16a64ax0NMKyMJdFD+RlTkByxvXp0HJqe SlWyp+0tERE8L80+ywrONrUs3X6gKJ6De72LUEzMSth6kewPuoUSi9xEnu2YpcySRr+3 m6fAdH8FVpw/kUsGHfQWOdvbGvY2BImjEs+nss5lzaLGbMpJGlMcoD3Lgg112Sqi4XpN hNjH/tdTyVdt6b3TQ5XMW18LAuCH+qOj32dK57+saqxQFJVhhzFTexCoWzJmgfRCJiqh OSPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=Cc+rnM3w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si23608489plp.304.2019.07.29.09.36.05; Mon, 29 Jul 2019 09:36:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=Cc+rnM3w; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388284AbfG2Ptz (ORCPT + 99 others); Mon, 29 Jul 2019 11:49:55 -0400 Received: from mail-vs1-f67.google.com ([209.85.217.67]:36536 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387461AbfG2Pty (ORCPT ); Mon, 29 Jul 2019 11:49:54 -0400 Received: by mail-vs1-f67.google.com with SMTP id y16so41073804vsc.3 for ; Mon, 29 Jul 2019 08:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uUW0YKHPLieEQydyNjaqE+DPJSP/Cf4fqcZtPwBzjUQ=; b=Cc+rnM3wvWjLyuINuMWXDGs5fxT5e9t10JNduKKSfTicMo308IATLLWRf1HbfpWVFJ b9HvoMhkEEadSy05edUEx8sn1mVyofmiYp6O2xYQvx9A1WtU4SuHaPssop3lf5ncDbCt yG5gMY4JLtex+4bR+Q44glXssu1lBsGRrlcGVKY1Zanm/FcxXPu9Lpcm8BrKG2Kqswp+ rb3AJRXbn4R0hDAXhtZXs3XIx2+JoGwvRFnm4k9C4FTS9vMmF8Ya9luCi/wweOUwz+Vp ouAIcGKMhFgKox4L1g3oYilw3A/fOpStl9pHs6Z5h8qQlenPlAGWPeZVHxefOnX7b/y2 zufw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uUW0YKHPLieEQydyNjaqE+DPJSP/Cf4fqcZtPwBzjUQ=; b=ojFTR1eAoQ8nMNBUUWjrC1SJj8EjcT73B4Hj+xxSWTyb1b2W3IHCGaZXBhXQbXkU0y XYilIm/LzNfbd96wkeIAm6qzOVV83EfoD0DN62bSHNNxCbakHDWZc63ChkPD31YEEzHx E3gdl53GH8NBS/+/cmH/CjElI3Hn6M5vpIqur/b52SoJP3tLxUCyWnhAcS1uRaDEvT/V 2axtMCz9VWnyXMNB1XGCcypLd56NFvScm/tN0RkY4aJGlT/VBsSXeFTyIIhJx5gFmL2D RwuzNOqqHr3IrPQ7H/p4tXUFBCeifswql7o7lxmqogNQyDJSphU5afcnYW/kSKxjWtIC RqmA== X-Gm-Message-State: APjAAAVo5aZDSGt+Euwca15RRS47wBArMefLa8jJ6DpxsdSXCLbDQKF1 DURIoefCfEBjVVBPdPqlYuk= X-Received: by 2002:a67:7087:: with SMTP id l129mr68222271vsc.206.1564415393680; Mon, 29 Jul 2019 08:49:53 -0700 (PDT) Received: from localhost (pool-108-27-252-85.nycmny.fios.verizon.net. [108.27.252.85]) by smtp.gmail.com with ESMTPSA id q15sm25893828vka.44.2019.07.29.08.49.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 08:49:53 -0700 (PDT) Date: Mon, 29 Jul 2019 11:49:52 -0400 From: Johannes Weiner To: Konstantin Khlebnikov Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Michal Hocko , Vladimir Davydov Subject: Re: [PATCH RFC] mm/memcontrol: reclaim severe usage over high limit in get_user_pages loop Message-ID: <20190729154952.GC21958@cmpxchg.org> References: <156431697805.3170.6377599347542228221.stgit@buzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <156431697805.3170.6377599347542228221.stgit@buzz> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 28, 2019 at 03:29:38PM +0300, Konstantin Khlebnikov wrote: > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -847,8 +847,11 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, > ret = -ERESTARTSYS; > goto out; > } > - cond_resched(); > > + /* Reclaim memory over high limit before stocking too much */ > + mem_cgroup_handle_over_high(true); I'd rather this remained part of the try_charge() call. The code comment in try_charge says this: * We can perform reclaim here if __GFP_RECLAIM but let's * always punt for simplicity and so that GFP_KERNEL can * consistently be used during reclaim. The simplicity argument doesn't hold true anymore once we have to add manual calls into allocation sites. We should instead fix try_charge() to do synchronous reclaim for __GFP_RECLAIM and only punt to userspace return when actually needed.