Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2617309rwd; Fri, 9 Jun 2023 14:12:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5imOD5gL7a8bx03rIZxdfLWJIkp9/stVmql/+E8QDSwLnSSXdzKWr01DcTsxZ1+xEuB5Z3 X-Received: by 2002:a17:902:f803:b0:1b0:6031:4480 with SMTP id ix3-20020a170902f80300b001b060314480mr2076015plb.39.1686345171817; Fri, 09 Jun 2023 14:12:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686345171; cv=none; d=google.com; s=arc-20160816; b=j7O1y5AfttVMLvbMScKZ3MznIyuzS8gjX59bfx5eXD1xrnUtvaonKgOBXf/N6KDytD S/tKQ3XnVgTUgOHFITzICd5IsYwOUe20oLx8w1IY3waFVK5s2cjUCJ6AfrFDNmWepiZQ wV2aae5F3aSVKPF6Q1A4/8ZwYZRzr21XzowKfYLM/vAsl4wuQFr/qpWrQEJbV6GmZre/ s9Y7Y7YaE4l1sZR4nCNTYUFXaOSu/KcgbK1UauvHzDglLNhLBhlFyf4q07ptbR6fAp8N 1uD0S2UYru2LKVvh/DfyOL2ubOk1HJwyOzIyDblOQ/KdyrjAIMoPviE6PhctRho+msUi IVCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1AR982kOtQF+PiURss59y7Vq08Tjvm44XyWZD10v/tk=; b=T3aa0w9lg/kxssiMXGBmBnb2MR9OE4TdM51KWeJCJkVZy8MviY8iYqDYUiNe4Ps9CA jSqlJOCfvjncUyvcEy6R/qhzevOh1lSi/EC3GiUZATt1sV3ckQM/DRhKY6KKkeXWQJnt hJExwmWKMM5UVm9GP7OR7HsquIYhJEfnk3e0kMIQd/WCRPmvVddCg2UG7tHtvU9TmxCf mmkCxhU4x8Gw+H/3NqlzASJUPkH2prIA6Fu6F1ye4fO4eJedYG5ZBOEBRaVUQ5vbSEEw geSp97kDRukaf25Mn7b8hbUMhMgx9sFYhiBfOLC6m8byMiYuNAEual7n5MVgoMIL9yI4 dqHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=V6NWpN+A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a170902ec8200b001ab0e3e0c1asi3339254plg.553.2023.06.09.14.12.35; Fri, 09 Jun 2023 14:12:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=V6NWpN+A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231981AbjFIUgi (ORCPT + 99 others); Fri, 9 Jun 2023 16:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbjFIUgh (ORCPT ); Fri, 9 Jun 2023 16:36:37 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53514D8; Fri, 9 Jun 2023 13:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1AR982kOtQF+PiURss59y7Vq08Tjvm44XyWZD10v/tk=; b=V6NWpN+AMDpXeJNkTRBv3dPtae Tzj/JkI2wQxxQB5+Mo6d7F5HHKLFxl8Q7BnvArDllM17cVvskCmCI7XSbvxQaMchNpQZZcOc3oy58 eBShFLfHl9UU+HUOQ1HRZfMwOkUXe22ME3bo9w3jYLJ3eGxc3UYwngSs4mIkbxMujxNSQ+HiAso6/ lR/cuWfFrhJHSUEBBaYC0VpyteCgKt8klipw4uzHaGy3QPOVek/hFuxD3lb/jNINC/oL1hG54bSdD n/xo/TMYdkUEFvQeR5sil5kuwpf2Z6Rq3v2SavvW4zy7/b7xVeWl8ZZy8J2bmiJvXKcRoeml8+BDb TFhJ6rPw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1q7ipp-00H1l0-8n; Fri, 09 Jun 2023 20:35:49 +0000 Date: Fri, 9 Jun 2023 21:35:49 +0100 From: Matthew Wilcox To: Peter Xu Cc: Suren Baghdasaryan , akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@suse.com, josef@toxicpanda.com, jack@suse.cz, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com, michel@lespinasse.org, liam.howlett@oracle.com, jglisse@google.com, vbabka@suse.cz, minchan@google.com, dave@stgolabs.net, punit.agrawal@bytedance.com, lstoakes@gmail.com, hdanton@sina.com, apopple@nvidia.com, ying.huang@intel.com, david@redhat.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, viro@zeniv.linux.org.uk, brauner@kernel.org, pasha.tatashin@soleen.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 2/6] mm: handle swap page faults under VMA lock if page is uncontended Message-ID: References: <20230609005158.2421285-1-surenb@google.com> <20230609005158.2421285-3-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 09, 2023 at 04:25:42PM -0400, Peter Xu wrote: > > bool __folio_lock_or_retry(struct folio *folio, struct mm_struct *mm, > > unsigned int flags) > > { > > + /* Can't do this if not holding mmap_lock */ > > + if (flags & FAULT_FLAG_VMA_LOCK) > > + return false; > > If here what we need is the page lock, can we just conditionally release > either mmap lock or vma lock depending on FAULT_FLAG_VMA_LOCK? See patch 5 ...