Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2705084rwd; Fri, 9 Jun 2023 15:51:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BnHmeTlg7wLZHwj4bAPZZUNrVR1+MgkjhlYppFQR1GZMGdhVcBGjy5z28n4mdxrXxjg5z X-Received: by 2002:a05:6a00:1407:b0:64f:7c9d:9c09 with SMTP id l7-20020a056a00140700b0064f7c9d9c09mr3084733pfu.32.1686351067444; Fri, 09 Jun 2023 15:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686351067; cv=none; d=google.com; s=arc-20160816; b=qP8PFT7Z+afXEq5zMZCkHobTEF0LEaL7zRl0ccrRxm7kEvsm91XntHLVZzr96P+5GR 9L8Q8/u5HYf82Oj5Ifr29+oSJFhYBgOtOSIThO9BVjHXononNyk4I98GX952DAjUsMAL OT732yy7MIeJnl9yuAZiy9tDvp0WkMFto0O7L34h5x/gQf7KjtPLY2/pMZepSTb0gcBo Htt8LzFuyWyqW//CycRRFCRumXEtRCA89+xHcE4EyPExTr0GOIE4eMr1cOexFx3rxrw+ ZKqbxrntNSdG5GnPkEqb9MFiL6EKExHMMDylPqk+ZBUkaPi5TUdOew3/BDR20YcU7fMI U58g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=W81GRpfjhB0fn0UjEwFmdlfLhr9DX7q54fVjX5JcBGg=; b=K9fa/K3ajkBvYZvlyuIUqgDBAqSU9Nssq56J+SJqWDBr5zOAjJPtsmQ/A+GmOO9D1M /6oQr7wC03tsVGCrG/VkptF6U/e9S9SZ9qYFbP8VYpy4efZWBrIwftdDY11TpTExJJVK yKQfyq1UNwnhHLZdOJ4RzSGjkCwXvDb88657q0E5161/kQRSbDciHDX0XDRG51qAR6dK ktNdwZA0ENwluSW4fljeud/aR5ymF3/Bd0QR+poU6wSV54/F2zKPnPeCALUeVyrww+57 9bbO4qeyv5spy6NQGDHo6JAvNTTSGe/IYGa0q286S7pZxswb4GGn5gnjiWBh+lOl1NAQ K2Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Jtv10dsQ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g139-20020a625291000000b0065f12af3ec7si3146174pfb.104.2023.06.09.15.50.53; Fri, 09 Jun 2023 15:51:07 -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=@google.com header.s=20221208 header.b=Jtv10dsQ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231707AbjFIWes (ORCPT + 99 others); Fri, 9 Jun 2023 18:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbjFIWeq (ORCPT ); Fri, 9 Jun 2023 18:34:46 -0400 Received: from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com [IPv6:2607:f8b0:4864:20::b2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AD0935B8 for ; Fri, 9 Jun 2023 15:34:46 -0700 (PDT) Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-bacf9edc87bso2153227276.1 for ; Fri, 09 Jun 2023 15:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686350085; x=1688942085; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=W81GRpfjhB0fn0UjEwFmdlfLhr9DX7q54fVjX5JcBGg=; b=Jtv10dsQTSwjnb3KMyeLUwInuJddeKAVXNSlN9syLvz8CxqBISG95KzggDHC3reL2w w1Y7ul4RtKxvRW5N4XVfUlaT8sxd4Lc8Vgj+uh74SpkuHibNLDPnP1EOaAw9aoerEnjb YCG0DrI+e5/HK3bln+hTlFdmyqRhN4T7rAvuDPnQMoK2aTl3IIONYrML5POouJAMgL8K fIHpI38+96N2+JOTHnTmatoXycHOyrhNA6Pq429ZH3RdrXT/rGlv3eFPRCZbmuSX3jVi Wu0ha6MiH4hG9zz4bzkECTS4bs/QhW8CCWyVsh56nIvhOatn/OiSvZgND3QHeYdeOx9/ OHsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686350085; x=1688942085; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W81GRpfjhB0fn0UjEwFmdlfLhr9DX7q54fVjX5JcBGg=; b=T3fnEEsqK/zY51ROXxrPBm/64zhYhIqSxyhPHMcXa8p4+eecLdZdASb8y9ggCnLE8y BLwA0ErWX1BlQuq5eTATfwdPSa2PxKe6ZUabkTf9GPtnEh3QFWahwysN2pJuBLIbckKO BubYVJGosdKySQSPx6oD9uzPO/tHK+zhIBlUZ1jiqqpv9W5pKr2aBRLN+sUm1vZyIBm4 bfJo7IklgfhkUlH9H1JbOSHT67BGu/XMNLJeJ+F1Y7PCgBTdjuCRG5qTxixv6Y46mvyf /KkfNQZyY1/rywqVq0PCIjFhY099i8JXZiq44GYGib2Q+qUc0UbIVq2Zd9I5vdcGL5jX 4TUA== X-Gm-Message-State: AC+VfDyELe26jSoK6iVGcWWpBkC6zrV3i0Fc/L8yCXhjpKZ3K1ubZBBh Gafnx01iJsZ909UdoJvfY9T8RJ6eOz6eryd+QjaLVA== X-Received: by 2002:a25:41c4:0:b0:bac:5d73:7f0a with SMTP id o187-20020a2541c4000000b00bac5d737f0amr2420821yba.17.1686350085069; Fri, 09 Jun 2023 15:34:45 -0700 (PDT) MIME-Version: 1.0 References: <20230609005158.2421285-1-surenb@google.com> <20230609005158.2421285-3-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Fri, 9 Jun 2023 15:34:34 -0700 Message-ID: Subject: Re: [PATCH v2 2/6] mm: handle swap page faults under VMA lock if page is uncontended To: Peter Xu Cc: Matthew Wilcox , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 9, 2023 at 1:45=E2=80=AFPM Peter Xu wrote: > > On Fri, Jun 09, 2023 at 09:35:49PM +0100, Matthew Wilcox wrote: > > 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 rele= ase > > > either mmap lock or vma lock depending on FAULT_FLAG_VMA_LOCK? > > > > See patch 5 ... > > Just reaching.. :) > > Why not in one shot, then? I like small incremental changes, but I can squash them if that helps in having a complete picture. > > -- > Peter Xu >