Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp831670imm; Fri, 22 Jun 2018 06:06:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIm3wt9Z7YQ8VSJkZtP+3B9Q6ZKVj34OJvAHna2L0FL1eGB+zfVllTwaygHkxNVLOZkqWcx X-Received: by 2002:a65:65ca:: with SMTP id y10-v6mr1347116pgv.359.1529672812299; Fri, 22 Jun 2018 06:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529672812; cv=none; d=google.com; s=arc-20160816; b=HqNdTyMhLmP9sEuayKJet84oh8KfCLeuTWtMjrosf+Evl2o4fvWfLR7KSXKey/X2Qn LcRn/7Yz/uMTW3UbBLixgVIuad1J/xjQoweoz/gPpvgOQVmi4chYF2X8yl4zue1M/oJL cSOhObTSdQXgAIiFkE5SbEJK3+nIBHXTxOeutEhCTZhchdemzImSsEWPjziwX8R5bJvC ezQUZJvrgoiBxEtl0p3GI1tLsifAMQiNtJ3oGdntIlo5FlPf2un6X45ey/t67/VBl/mK P4QGQKNsfz53/al7intj2gIXs93Rsa9oT0r1MQpL4VDN8oOsjYVz4uwllIV0fc0yWlk7 f0nA== 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:arc-authentication-results; bh=EgcFepEO1mGfT/PL3dtf15Rjq5fHERwtqN6kJNcPgQc=; b=XgFeIyiUyZYEAB28oFUbRZgeVa5Xp5utd2vFt2857NtjnooAc9VD160w493+aGXnFY 6bdlVAdH/D6F1Lpe2dUVfpGFcHAflbb4LsVxA07KXO1qHa/w4hBLh/CjAMvHAJCuWUbe Y5yyy5cb6H/LJWsNzbZ37tKBSH4lkh+yScKpuVlk7+P5TfaR6ZOKz6JRCPhKVp2VuQq5 f54a5Y8Rf7Ad1Xq1xvCloSXY2Typt67vzRyMbqPNH0vKL3U+Ysn/3GChls+NZLWzipB4 K/njq3aafGmsUq0gKTf5JKKmOJTpfbg1WL0s+Oof8VJxMTBwrcvzMRy9hWHjG7NOkEy1 eO6g== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11-v6si7914164plp.108.2018.06.22.06.06.16; Fri, 22 Jun 2018 06:06:52 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751438AbeFVNF1 (ORCPT + 99 others); Fri, 22 Jun 2018 09:05:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:51615 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751256AbeFVNF0 (ORCPT ); Fri, 22 Jun 2018 09:05:26 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 50C56ACF3; Fri, 22 Jun 2018 13:05:25 +0000 (UTC) Date: Fri, 22 Jun 2018 15:05:24 +0200 From: Michal Hocko To: Mikulas Patocka Cc: jing xia , Mike Snitzer , agk@redhat.com, dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: dm bufio: Reduce dm_bufio_lock contention Message-ID: <20180622130524.GZ10465@dhcp22.suse.cz> References: <20180615115547.GH24039@dhcp22.suse.cz> <20180615130925.GI24039@dhcp22.suse.cz> <20180619104312.GD13685@dhcp22.suse.cz> <20180622090151.GS10465@dhcp22.suse.cz> <20180622090935.GT10465@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 22-06-18 08:52:09, Mikulas Patocka wrote: > > > On Fri, 22 Jun 2018, Michal Hocko wrote: > > > On Fri 22-06-18 11:01:51, Michal Hocko wrote: > > > On Thu 21-06-18 21:17:24, Mikulas Patocka wrote: > > [...] > > > > What about this patch? If __GFP_NORETRY and __GFP_FS is not set (i.e. the > > > > request comes from a block device driver or a filesystem), we should not > > > > sleep. > > > > > > Why? How are you going to audit all the callers that the behavior makes > > > sense and moreover how are you going to ensure that future usage will > > > still make sense. The more subtle side effects gfp flags have the harder > > > they are to maintain. > > > > So just as an excercise. Try to explain the above semantic to users. We > > currently have the following. > > > > * __GFP_NORETRY: The VM implementation will try only very lightweight > > * memory direct reclaim to get some memory under memory pressure (thus > > * it can sleep). It will avoid disruptive actions like OOM killer. The > > * caller must handle the failure which is quite likely to happen under > > * heavy memory pressure. The flag is suitable when failure can easily be > > * handled at small cost, such as reduced throughput > > > > * __GFP_FS can call down to the low-level FS. Clearing the flag avoids the > > * allocator recursing into the filesystem which might already be holding > > * locks. > > > > So how are you going to explain gfp & (__GFP_NORETRY | ~__GFP_FS)? What > > is the actual semantic without explaining the whole reclaim or force > > users to look into the code to understand that? What about GFP_NOIO | > > __GFP_NORETRY? What does it mean to that "should not sleep". Do all > > shrinkers have to follow that as well? > > My reasoning was that there is broken code that uses __GFP_NORETRY and > assumes that it can't fail - so conditioning the change on !__GFP_FS would > minimize the diruption to the broken code. > > Anyway - if you want to test only on __GFP_NORETRY (and fix those 16 > broken cases that assume that __GFP_NORETRY can't fail), I'm OK with that. As I've already said, this is a subtle change which is really hard to reason about. Throttling on congestion has its meaning and reason. Look at why we are doing that in the first place. You cannot simply say this is ok based on your specific usecase. We do have means to achieve that. It is explicit and thus it will be applied only where it makes sense. You keep repeating that implicit behavior change for everybody is better. I guess we will not agree on that part. I consider it a hack rather than a systematic solution. I can easily imagine that we just find out other call sites that would cause over reclaim or similar problems because they are not throttled on too many dirty pages due to congested storage. What are we going to then? Add another magic gfp flag? Really, try to not add even more subtle side effects for gfp flags. We _do_ have ways to accomplish what your particular usecase requires. -- Michal Hocko SUSE Labs