Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp777956imm; Fri, 15 Jun 2018 06:11:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLb6XqGkEaHrNCk4/X3hGvaNDk5AdEUDPU2sr4EFLW/iKYm3J1mAst6QB6H2SH6pYZph8V5 X-Received: by 2002:a62:8d03:: with SMTP id z3-v6mr1892455pfd.112.1529068289102; Fri, 15 Jun 2018 06:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529068289; cv=none; d=google.com; s=arc-20160816; b=S0S+g9iL89zU0tSSynkW/fyK8f/M1tFRMGTWAj4pbB1XffwJWtui1yUMClpK93t9b0 p/nvNV4b7qxS0IKNnCJdlXU3fFWuCA9FRFteCilWb1aO9rX/kWSPfvwb2GBYlo0dnosk NVlbk21/P0kzmorj4CQcFpsvDuhbcCDNCoNcteg9q6GUtZsK0aFq7jDRjD55rNHMCQQb 5R80bCBwBkNMH0m2ciEf1Ezkvhf+RZC4tXLJ9vMxJdc9GXkvpecKKJtBmI8UL92EvoRU hSZLxQWx+YD/7n6Sz/M2V85Myi0z+TDe0Q/bNA7z0updQe/zZ4OQM7MuTmxPmE3P+19+ ASEg== 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=dxX7LBlqN37wy8Fx8lTQpSOY5P1hq5PUMcHGaDFilJk=; b=GRhEvVMBvF38vTF2vfkWLpTpZjp/HZYBM2EEIinjBov1ubW7JkBPazHFMtJqsG/Lbs vVcLZF5fvKLMY/22ZIB4WQ/m4P3dwoCvAyMGnsQrfP9TeGOv9+uGuM077NCjB44VVZmm WlbTvZEGXSjnpgmPL3v69TPjS+elbh2P5/Tpy2rX6QNgwYTry1qWoIds+PYX7n1lS/Ux 7vSr28kKu/Axj00YgHABjPf6Z6iLIA5a7LLepZQH5kUXMeg7rW5N+jezxveyIzlsuwfg 4J0UpCcyDE1zyY3r0ltM/Lf7koPO0Bqo2z4wRzLfLDKhx2sQd5/cUgLe9/s/bieTqb8D /A+w== 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 q69-v6si7806722pfj.51.2018.06.15.06.11.14; Fri, 15 Jun 2018 06:11:29 -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 S936266AbeFONJ2 (ORCPT + 99 others); Fri, 15 Jun 2018 09:09:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:40769 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936215AbeFONJ1 (ORCPT ); Fri, 15 Jun 2018 09:09:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DD691AC62; Fri, 15 Jun 2018 13:09:25 +0000 (UTC) Date: Fri, 15 Jun 2018 15:09:25 +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: <20180615130925.GI24039@dhcp22.suse.cz> References: <1528790608-19557-1-git-send-email-jing.xia@unisoc.com> <20180612212007.GA22717@redhat.com> <20180614073153.GB9371@dhcp22.suse.cz> <20180615073201.GB24039@dhcp22.suse.cz> <20180615115547.GH24039@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 15-06-18 08:47:52, Mikulas Patocka wrote: > > > On Fri, 15 Jun 2018, Michal Hocko wrote: > > > On Fri 15-06-18 07:35:07, Mikulas Patocka wrote: > > > > > > Because mempool uses it. Mempool uses allocations with "GFP_NOIO | > > > __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN". An so dm-bufio uses > > > these flags too. dm-bufio is just a big mempool. > > > > This doesn't answer my question though. Somebody else is doing it is not > > an explanation. Prior to your 41c73a49df31 there was no GFP_NOIO > > allocation AFAICS. So why do you really need it now? Why cannot you > > dm-bufio always used "GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | > __GFP_NOWARN" since the kernel 3.2 when it was introduced. > > In the kernel 4.10, dm-bufio was changed so that it does GFP_NOWAIT > allocation, then drops the lock and does GFP_NOIO with the dropped lock > (because someone was likely experiencing the same issue that is reported > in this thread) - there are two commits that change it - 9ea61cac0 and > 41c73a49df31. OK, I see. Is there any fundamental reason why this path has to do one round of GFP_IO or it can keep NOWAIT, drop the lock, sleep and retry again? [...] > > is the same class of problem, honestly, I dunno. And I've already said > > that stalling __GFP_NORETRY might be a good way around that but that > > needs much more consideration and existing users examination. I am not > > aware anybody has done that. Doing changes like that based on a single > > user is certainly risky. > > Why don't you set any rules how these flags should be used? It is really hard to change rules during the game. You basically have to examine all existing users and that is well beyond my time scope. I've tried that where it was possible. E.g. __GFP_REPEAT and turned it into a well defined semantic. __GFP_NORETRY is a bigger beast. Anyway, I believe that it would be much safer to look at the problem from a highlevel perspective. You seem to be focused on __GFP_NORETRY little bit too much IMHO. We are not throttling callers which explicitly do not want to or cannot - see current_may_throttle. Is it possible that both your md and mempool allocators can either (ab)use PF_LESS_THROTTLE or use other means? E.g. do you have backing_dev_info at that time? -- Michal Hocko SUSE Labs