Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5610198rwd; Mon, 12 Jun 2023 07:24:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5i7EFynp3zAkwoRhCbwMgx9h0fjPoMY8MqdLDv/gpTDn81za/0XDK1GB6CB/jCK1KofsNH X-Received: by 2002:a17:902:f546:b0:1b2:1942:9106 with SMTP id h6-20020a170902f54600b001b219429106mr7284664plf.64.1686579896235; Mon, 12 Jun 2023 07:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686579896; cv=none; d=google.com; s=arc-20160816; b=oWYNNz6qEumer5ZMRxDwpvYnQQfGyJZOAtt5VV2GN/kdQN6s1q7TCYuzvpH557e7wr sT6taRRoFLM8OSHKPJVIGxWPYsrmrQs6MvQs7e6mI3HOnhxV9POqjMF7xUmUkPGpugSk RCbekgEG1Gxr0PQd9TFvfYcUsUC63cVe9aeV89SNlfh3YNfM4+ykhBmjxTrOoaVDqnEO LwFcXl7mRGknpc3J7acHFjOCcBSPrw85uUNtbfncMZ2SjgFGSLzpXlDxp9DUAWLllM1F kXS0cmd0krFySF6swUIlOhQnUZuVWcZB7QfskaO3HBD17iidaFloiw/QubswrqyROk+U ZCIw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GKBfBKTeVMZb+dt8ekYcaXAyT4nwQrKdK59Oup6XbjM=; b=YIE9mVtNtuO4p1zs+EP0t7tegI46PhbyL3r0I3i532VfXDY/C7A3vieJr8EDv8gr9p 9wAUhGgM7Tuo1JgBY4e8wQVE9kvtcvXu9nG/wD3gGpaEw9fI3oDOXQ6aZzah3uOnrCp9 vdHtX3I5YGQrJaYDUtMaVgTC132poon0+/iHFmjnMR9acyunCdxhmHzn7Ck7BiguL9vf Sb/J1JxEIVtGx5rlIp4X+FLhiZsn9a99SkjotgWoYruM8ZsDoHQ9UziSwoskwlwVBvir XxwdkLPRoXFocbp2l2eSlAUA2CtuN+c+oJlNKi5gGTKnAzh3i4zG193gavZPlOrwU68+ qy5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="G36P5n/+"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a170902e5c600b001ac7ea55768si7366639plf.499.2023.06.12.07.24.43; Mon, 12 Jun 2023 07:24:56 -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=@redhat.com header.s=mimecast20190719 header.b="G36P5n/+"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235261AbjFLOAs (ORCPT + 99 others); Mon, 12 Jun 2023 10:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233871AbjFLOAp (ORCPT ); Mon, 12 Jun 2023 10:00:45 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41CA71B4 for ; Mon, 12 Jun 2023 06:59:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686578380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GKBfBKTeVMZb+dt8ekYcaXAyT4nwQrKdK59Oup6XbjM=; b=G36P5n/+PwztKP0/O9iJc6P3m3+tsrp/GerrjZdk9xUaxU/31MVfgDcNB1mYXEZ0aFDBk2 FrL0AyX5BLKab29WPxUG4yHGDn3yR+t44f4g0kkcS6nYq9aKGLrlchx6VnP8lJJgDH1v9P KzKx2WJxuMKd2BZ8k7/4zeALXT575xk= Received: from mail-vk1-f197.google.com (mail-vk1-f197.google.com [209.85.221.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-493-LwIUAKDzMZ-o8x7E8OwVSg-1; Mon, 12 Jun 2023 09:59:33 -0400 X-MC-Unique: LwIUAKDzMZ-o8x7E8OwVSg-1 Received: by mail-vk1-f197.google.com with SMTP id 71dfb90a1353d-4644c388212so105129e0c.0 for ; Mon, 12 Jun 2023 06:59:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686578363; x=1689170363; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GKBfBKTeVMZb+dt8ekYcaXAyT4nwQrKdK59Oup6XbjM=; b=H9pBYthLSoOKNu8S2kZf3xYmgieKId9jO6oEuM00c52dOfQAb88bXVgYgP9JrnFGJG xm+PsxsWcAQxaLMa2f27kJEb5oIzaqIKBkXQ/tkVal8ju85r0BJMpyXG/BMmGA5+7kv8 j/595FjNRlDasKQsSrrP+4HYsiswEYCkDobD3sgL+8Hm4S5yodlMqx5ho7XhFq+FdYJt 1wCWcQpSA7n5tJ9PqjqL4Sxg8vbWHGVkVRB2hpTgR3MbjwHe/hOZxA/CLhSXNK1e8XfC 79MAMidSrtNvvpp4Pa4C4KhuKe6US0ZA2Ta4SU6BJbVoAs2NVzd+kA+UA5eG8Sc43z2h 5SGw== X-Gm-Message-State: AC+VfDzsUhVecdlGzlp92mShd8VXGl55aTMFb6HxzNCt/SrKSssjpMZK /bsgiiyFzQ8Ql6tDbmzcgn7oiPFT67ayVcR6kL9EeQ1Q8DnI2s5FsJ0KGwaloJrCgvhZ9RRk7Kq +v54eNjmZmqxSCtwuVwLyOf8H X-Received: by 2002:ac5:c858:0:b0:457:3a45:38d2 with SMTP id g24-20020ac5c858000000b004573a4538d2mr3539469vkm.1.1686578363649; Mon, 12 Jun 2023 06:59:23 -0700 (PDT) X-Received: by 2002:ac5:c858:0:b0:457:3a45:38d2 with SMTP id g24-20020ac5c858000000b004573a4538d2mr3539453vkm.1.1686578363405; Mon, 12 Jun 2023 06:59:23 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id t18-20020a0cea32000000b005ef54657ea0sm3221971qvp.126.2023.06.12.06.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 06:59:22 -0700 (PDT) Date: Mon, 12 Jun 2023 09:59:19 -0400 From: Peter Xu To: Suren Baghdasaryan 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 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 03:34:34PM -0700, Suren Baghdasaryan wrote: > On Fri, Jun 9, 2023 at 1:45 PM 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 release > > > > 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. Yes that'll be appreciated. IMHO keeping changing semantics of FAULT_FLAG_VMA_LOCK for the folio lock function in the same small series is confusing. -- Peter Xu