Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2691240imm; Thu, 18 Oct 2018 20:36:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV62BkuSX3AigstXa8R/zGFRP1X2+D/wNWwxzdr8c6cTVpIFd/2B+MtOgUW6rxEOa0dejTQm9 X-Received: by 2002:a63:d00b:: with SMTP id z11-v6mr31465362pgf.317.1539920216595; Thu, 18 Oct 2018 20:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539920216; cv=none; d=google.com; s=arc-20160816; b=SCTN5eHp5MqdmF+GbQxwyFKVuEe72UBLiN1CEz4RlL7oFuaBVJgVWYlN8LYhZMZ3hc vZY5DEo3eRh6/Y3IDWST5pend4DNFZIT5jFmYBqcrh7Zn35xjrAsAyU7Tg8ZBUrjaFOQ 9Z3ufCMVZSsUcsR4bZ768XOlmtQRTs3T8iFceHvnAbn0edzPgWUVtn/pFh6H5wCCpObB U2Vmq3PG4+P6uQ3YYtqNMET7HgTu9QlDrTgBfmy00ITK32Md4zEH51nOwX7Lfr07sWxL Wlhkbg6sxVB7/vcGg9PT2IpDTmDXh6VXVv9eG2SssUZ2zdCqLl33PqRP/nkN8FKv2FeV SVLA== 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; bh=JLTAfy7gFwmgC9ciIQfkoiEYpqJxqVS+se0WZNMFlVw=; b=vA9HT2/PpGj0Acg53RMjvnQoPQ4WO8Lho4xNOXMc8xwEOCf6eFnzFCILPqbshwm74J v2pSjrX1KmMQ3MiBOVx5xgwU/oGmDxemlmJa2KdMRUHriph3DMH2Kwzgbst4I4AACuZx +/n6Ob6LlB2wca7WbO+pDHI3U4eFkNVAKYSAPZDYTJHCNUyh/kL39eCX5mu8c4rLERRQ K9CzyG7dax0dnis01xXRcs+MKRufOvsvQUOnOu/BQsqCZfrtCUN49aTMBN+rfUK68hb5 xdIaDaFOzLPfs+Y5dulEx1QhUooUzZeATCb/VafrzVzy0WVFiHiJZ14qDhonhG3NMa55 Z8iQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c184-v6si22877249pfg.215.2018.10.18.20.36.40; Thu, 18 Oct 2018 20:36:56 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726967AbeJSLk0 (ORCPT + 99 others); Fri, 19 Oct 2018 07:40:26 -0400 Received: from ipmailnode02.adl6.internode.on.net ([150.101.137.148]:55887 "EHLO ipmailnode02.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726478AbeJSLk0 (ORCPT ); Fri, 19 Oct 2018 07:40:26 -0400 Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail02.adl6.internode.on.net with ESMTP; 19 Oct 2018 14:06:12 +1030 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1gDLa8-0006bD-Ep; Fri, 19 Oct 2018 14:36:12 +1100 Date: Fri, 19 Oct 2018 14:36:12 +1100 From: Dave Chinner To: Josef Bacik Cc: kernel-team@fb.com, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, riel@fb.com, linux-mm@kvack.org Subject: Re: [PATCH 6/7] mm: allow ->page_mkwrite to do retries Message-ID: <20181019033612.GL18822@dastard> References: <20181018202318.9131-1-josef@toxicpanda.com> <20181018202318.9131-7-josef@toxicpanda.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181018202318.9131-7-josef@toxicpanda.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 18, 2018 at 04:23:17PM -0400, Josef Bacik wrote: > Before we didn't set the retry flag on our vm_fault. We want to allow > file systems to drop the mmap_sem if they so choose, so set this flag > and deal with VM_FAULT_RETRY appropriately. > > Signed-off-by: Josef Bacik > --- > mm/memory.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index 433075f722ea..c5e81edd94f9 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -2384,11 +2384,13 @@ static vm_fault_t do_page_mkwrite(struct vm_fault *vmf) > unsigned int old_flags = vmf->flags; > > vmf->flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE; > + vmf->flags |= old_flags & FAULT_FLAG_ALLOW_RETRY; > > ret = vmf->vma->vm_ops->page_mkwrite(vmf); > /* Restore original flags so that caller is not surprised */ > vmf->flags = old_flags; > - if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) > + if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | > + VM_FAULT_RETRY))) Mess. #define __FAIL_FLAGS (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY) if (ret & __FAIL_FLAGS) Should kill the unlikely() at the same time. -Dave. -- Dave Chinner david@fromorbit.com