Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4962319rwd; Sun, 4 Jun 2023 17:29:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZRIdx07xhIO7etAvjgfnvm312OTbpv5/J38wuIW1g0MXUJIxDDpaU/FUAfaCrJ2zKEsly X-Received: by 2002:a05:620a:2b9b:b0:75b:23a0:dec5 with SMTP id dz27-20020a05620a2b9b00b0075b23a0dec5mr21497980qkb.67.1685924984137; Sun, 04 Jun 2023 17:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685924984; cv=none; d=google.com; s=arc-20160816; b=pjqOVbW3T5pebSAwRUSbXfXnMcuA0JnnDf7u8yuO98SRkOoZEdWI/ZoFSfKSGRZBEu adt++ZGL6WLgYm0h517T4zfeq3ZYwDG0bIIZCszaCLMxi/mCqkhvQdEQXb1E8qrR1BYs U9Z1hV3TisWHFV6o1gz/kHQ3KUxb9Bkl8fHy6QE+1HqOHgVJ6y5gNz/5y4gaauDdAIbm ilUI65rcwwRtPD3UNmr+68+/BIk99jb5LUmEkk/GkjBrQj6MsiH2+Pyj2Xyjhi/R4arQ 8so6p9aUkXI8ujkCTJTmBhWNi1yWr7xpreRLznJCBURYJrj8YKs2jdBkBW7YvHrCCLTS 1l2A== 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=koo3yH5MPFViQPVYh2VWDsSwxsVmauul0f0H0scecGw=; b=YAykcJwtlyYCNHqLl2VGCdDIGvK75Qq4Assz2sFOViUoyVDGkNxL99CM6cp8p6GInl 9dRTZAadcTDhFq8fbRwGwywIeZojg7g+p3vClg99mKau5VFfGaXHdSQbJteRQrEElTPd jazEFjItUiGUx2PYA9ZBRA2mcbmzmxyEGspJrKyYIzNWD5s3Rk2I+wKrCuJjXVdwJ4hU rdw0vk+PHjFKxDIo8+RubhCXJXpN4XTApzGHQN8C9ODuYrHl2vqV24B+RvB6TIXCR5P9 W1v2cj/UgdgOMScdzQiSoVPdfcfe4w6k6B+xodCqTdqiKUG6TMcDCLyxrLIMPVrp1R+M oqJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Yf6ycMWf; 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 8-20020a17090a19c800b0024730b93a6asi6515352pjj.147.2023.06.04.17.29.32; Sun, 04 Jun 2023 17:29:44 -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=Yf6ycMWf; 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 S231363AbjFDX7N (ORCPT + 99 others); Sun, 4 Jun 2023 19:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229886AbjFDX7L (ORCPT ); Sun, 4 Jun 2023 19:59:11 -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 737E0C4 for ; Sun, 4 Jun 2023 16:58:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685923103; 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=koo3yH5MPFViQPVYh2VWDsSwxsVmauul0f0H0scecGw=; b=Yf6ycMWfM2J8FOvea5OuRJeaTNXuFStLtL5IWPc7OtlzhtTMYvZpdsFnMlhRbnRrClHcmq 6jcxURsH3yFPu5PbltCrNC2bC0RUKDORxpNUg00fwxMSVkVhpe+CItgHR/++5OwZY4fhT+ ioXkqOkq94AVym88H6vCzhsCUygI/3M= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-347-WPmxjeZBNguV2L6VK6rM-A-1; Sun, 04 Jun 2023 19:58:21 -0400 X-MC-Unique: WPmxjeZBNguV2L6VK6rM-A-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-62607e62fa8so5070316d6.1 for ; Sun, 04 Jun 2023 16:58:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685923101; x=1688515101; 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=koo3yH5MPFViQPVYh2VWDsSwxsVmauul0f0H0scecGw=; b=VJO8BakGxDO6INTgMoMZ4mG7/KSXda9xtyiUfr3LUSbH5JDI7cfqBeb1vdz0YNNxmi p8A7ZdFMGkDdUZyCQrcg2n2d4MeOcLCnTP93PQScXWGwj2xkYYdQreUiJE+YnoD8m672 96jlUsfUeKvVAKwStdGV0xiYvJi49Kf+T+ccailIJpqNbNSXNlu4fggqVin1sAhSs10g myAdg1w1QLlGqV5aXBK6nRpL+5N5geCrJtnQRA/c+B3ejsDxxkB0XJCZu18ixcs+mJyJ 8/Kk8w5GfHPL7xBm5ps3Fi/5blmC3jo8rPoEwpP5QLA619FgxbLaOatTStIy7XvlvYLY CJzA== X-Gm-Message-State: AC+VfDwRFA8tML8Oj6uZkGgPYs83QzyMZV/2ci6XYqLyfxTxSCclOQxf gdOoj0PuArlg4SjDDnvB0n/ge6wXnOTfkikf4thUbE0qsjbH2sWskFU2Edp9kW6PU8SaLLKlejk 16nqItBuU5iQoxDXdm1mO8E8a X-Received: by 2002:a05:6214:d62:b0:625:88f5:7c62 with SMTP id 2-20020a0562140d6200b0062588f57c62mr19160384qvs.2.1685923100975; Sun, 04 Jun 2023 16:58:20 -0700 (PDT) X-Received: by 2002:a05:6214:d62:b0:625:88f5:7c62 with SMTP id 2-20020a0562140d6200b0062588f57c62mr19160374qvs.2.1685923100693; Sun, 04 Jun 2023 16:58:20 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id ph14-20020a0562144a4e00b00605f796d30esm3813391qvb.51.2023.06.04.16.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jun 2023 16:58:19 -0700 (PDT) Date: Sun, 4 Jun 2023 19:58:18 -0400 From: Peter Xu To: Yang Shi Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Alistair Popple , Andrew Morton , Andrea Arcangeli , "Kirill A . Shutemov" , Johannes Weiner , John Hubbard , Naoya Horiguchi , Muhammad Usama Anjum , Hugh Dickins , Mike Rapoport Subject: Re: [PATCH 1/4] mm/mprotect: Retry on pmd_trans_unstable() Message-ID: References: <20230602230552.350731-1-peterx@redhat.com> <20230602230552.350731-2-peterx@redhat.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=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 02, 2023 at 07:04:48PM -0700, Yang Shi wrote: > On Fri, Jun 2, 2023 at 4:06 PM Peter Xu wrote: > > > > When hit unstable pmd, we should retry the pmd once more because it means > > we probably raced with a thp insertion. > > > > Skipping it might be a problem as no error will be reported to the caller. > > I assume it means the user will expect prot changed (e.g. mprotect or > > userfaultfd wr-protections) applied but it's actually not. > > IIRC, mprotect() holds write mmap_lock, so it should not matter. PROT > NUMA holds read mmap_lock, but returning 0 also doesn't matter (of > course retry is fine too). just skip that 2M area. True. > The userfaultfd-wp is your call :-) Yeah I think uffd should still be a problem. I'll reword the commit message (by dropping mprotect example) in the new version. If you have time feel free to have a look at patch 4, where I think it's a bug for pagemap too (I didn't check as close as all the rest; the memcg one might be suspecious, that's also in patch 4). Thanks! -- Peter Xu