From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92B4BECAAA1 for ; Thu, 27 Oct 2022 21:58:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9A2F6B0072; Thu, 27 Oct 2022 17:58:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E49CB6B0073; Thu, 27 Oct 2022 17:58:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEA5F6B0074; Thu, 27 Oct 2022 17:58:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BADBE6B0072 for ; Thu, 27 Oct 2022 17:58:13 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7418CC0F0D for ; Thu, 27 Oct 2022 21:58:13 +0000 (UTC) X-FDA: 80068093266.24.F930149 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) by imf29.hostedemail.com (Postfix) with ESMTP id 2A208120008 for ; Thu, 27 Oct 2022 21:58:12 +0000 (UTC) Received: by mail-ot1-f49.google.com with SMTP id d18-20020a05683025d200b00661c6f1b6a4so1961989otu.1 for ; Thu, 27 Oct 2022 14:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=0Uq26a1rwMYIjpLBQk8nVo2sH1wrMjVXp0pojJk0NFQ=; b=cvf2A9oZAY4UQ0Tq36JlxosoocbwdV/ipWMMUeIdV9Fv6B9WqJBc8vF5axnD/klVCy dNnL5VDwrwBjc9ESODVzP4ZMuq9+QQXIPtn+UqVBRnhIw7UllMjCnmkraTT7PzFKaD2W tkKkDy42ZEE1EbTiaUCXEGs+cQKSX67TH1l5pLD0jo9zjWHbgT7snUMa2mvuZM4B+n1T P6JC4Ug8Bax+mEqUZty6VV13dDLPoDLFAa4l0jLUOTdOj/5KlwiM+HWoQSBQTQH1DdhY L+ArcuiENjHA9qjjQbH3jdQbasAHxnRbjeEicupcpq45lBGtaAzNVR+wU1Lfs3t/NECL 4sPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0Uq26a1rwMYIjpLBQk8nVo2sH1wrMjVXp0pojJk0NFQ=; b=gsQ9s9CrEpgJ73Ae+cnwzP/Q5zYXbhLy1zfTr1PI+TIG2qZ57+SMiV5UNewwMVfPC9 9a/HQEhLOHIppnwVq7jXSpn76lHkqcyP86YOejekTTxwLa70LCkBEy2QVlGCGAs1ItQM vgiBWLp5vl4jrflc5aLUQZb0copCHr9ye2ayx7rZRv3S2Qc1oF3gEczNz3z3ETshUEG8 CaNWVpTRTWLEQqUyllJshwGDsiq3BFv2DkzThoUW9mj48ZP1D0XKmj3Lp+ROjz/GWhXR gZ5BJMmx5EnypLqx3X05QG+H5Gc3BusFjl5o+qvTx0XW9uKgNUH/oiJ5uPsiyW9ujh2Z su5w== X-Gm-Message-State: ACrzQf23VPXVpH4PKSZu5cUe26e3sq18YTmCUmTQgzbjK3TXXVcR8rkB D085OBg6lstnznoO96Q0h0oRYg== X-Google-Smtp-Source: AMsMyM6Bi+L5A/E2O0uQPiXczSxifGF2nbn8FWHOQ7jUJBtS0WdTltn+K/qqa/dyhEwPiCALMH1ptg== X-Received: by 2002:a05:6830:91e:b0:661:c4ad:d8e3 with SMTP id v30-20020a056830091e00b00661c4add8e3mr5388067ott.34.1666907892191; Thu, 27 Oct 2022 14:58:12 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id v14-20020a056870310e00b0011dca1bd2cdsm1207937oaa.0.2022.10.27.14.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 14:58:11 -0700 (PDT) Date: Thu, 27 Oct 2022 14:58:02 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Peter Xu cc: Hugh Dickins , Yuanzheng Song , akpm@linux-foundation.org, gregkh@linuxfoundation.org, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH STABLE 5.10] mm/memory: add non-anonymous page check in the copy_present_page() In-Reply-To: Message-ID: <8aad435-bdc6-816f-2fe4-efe53abd6e5@google.com> References: <20221024094911.3054769-1-songyuanzheng@huawei.com> <3823471f-6dda-256e-e082-718879c05449@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666907893; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0Uq26a1rwMYIjpLBQk8nVo2sH1wrMjVXp0pojJk0NFQ=; b=ty5Jdg5HleQXmBOF6drEZ96dbFrGhZAGEnVKSQM+9/8EBiAEikiLmpeeAEBS9BsSfxYajx XVlHyB5sWUc0jPx7J9S4fjUFVrip+Lc4VgBIgZ6fod40O139HLoOe9gZSCzWABbrbz6Lag HrsrPWfOgpzyQwTMpDoZ9qhrCy/zELQ= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=cvf2A9oZ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of hughd@google.com designates 209.85.210.49 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666907893; a=rsa-sha256; cv=none; b=mKyOkxD4bQriz1jSIp59nr7FHulcFhYaIlVf8IKIBhXm1DEqvRA6o1dZspR6uahwg3NZFU e1B0UoAOy8e8TZYjowLWZpbWDXXLglpCT7F8BTg7iNZ9ltWt6mkHICaSw/LXCaPhO5UQMI u//0xISscNabR1pPV0t7haFgjtDk3ho= X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2A208120008 X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=cvf2A9oZ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of hughd@google.com designates 209.85.210.49 as permitted sender) smtp.mailfrom=hughd@google.com X-Stat-Signature: tzqoteoh6moo4rij5aq54i9s5rk6dn49 X-HE-Tag: 1666907892-50259 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000012, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Let me delete stable from the Cc, this discussion is not for stable. On Thu, 27 Oct 2022, Peter Xu wrote: > On Wed, Oct 26, 2022 at 06:48:29PM -0700, Hugh Dickins wrote: > > > > And I imagined that the correct fix (short of going forward with David's > > full changes) would be to back out to a context where one could add an > > anon_vma_prepare(), then retry after that - involves dropping pt lock, > > maybe gets nasty (tedious, anyway). > > Right, that looks a larger changeset with minimum benefit - the page is > still inconsistent before fork(), and also for users don't fork() at all > after the RO pin. Sorry, I don't understand any of what you're saying there: but you appear to be saying ("larger changeset with minimum benefit") that my suggestion would not be worth the effort - fair enough, but... > > It looks to me Hugh's suggestion would be the best suite here for stable. > Yuanzheng, what do you think? ... now you appear to be saying it would be worth the effort. Oh, perhaps you're referring to just the change to check dst anon_vma: perhaps, but I'm really having to guess at what you mean. But none of that matters as much as below... > > For the long term I think we should wait for David's further unshare work > so gup_must_unshare() will work for page caches too while mapped private. I do wonder if in the long term we shall have to port all David's work back to 5.15 and 5.10 (but I think there's yet more to come from him). But set aside that thought for now... More urgently, in the short term: Peter, you've made no reference to David's mail, where he concludes that Yuanzheng's !PageAnon patch is the appropriate one; and David, you've made no reference to Peter's mail, where he concludes that my doubts were correct, and it needs a different patch. You appear to disagree over whether a RO-pinned file page needs to be copied at fork() time. I don't know, but I hope you can agree on that (in the 5.10 and 5.15 context: maybe David is thinking of the 6.0 context and Peter of the 5.10 context) before going further. (I'm hoping David is right, and I was plain wrong, since that's easiest.) Hugh