Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp274278rwb; Thu, 12 Jan 2023 19:50:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXuv0XIDTVac1kxQH76XHhRsxj4lilY4+Mp+BFe0c9IW5VgNLUqZFbApj86gnYBl9iNCTWnL X-Received: by 2002:a17:902:ed11:b0:193:38a1:68e4 with SMTP id b17-20020a170902ed1100b0019338a168e4mr12904956pld.0.1673581820327; Thu, 12 Jan 2023 19:50:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673581820; cv=none; d=google.com; s=arc-20160816; b=yhGjdwL8DMdFKuyPDfRylMZ5VS3b6tSkMD6hL5xiJwOxK/b+aQDlH9OFPJ/tIb9iZ7 uGtDbyyCK26oOU6Ih014YX/n1koRejDT5OZ6ihSxD1BJeVB8rQgLNNJzrxxl9WfSAdqh 7h6xuoCaB/pr4+P73PDzXU8qq16zmTxtYlOKhPgXvF/cZ3TRksZT0PFB3iXBRWwEaALZ Dk5Y36UIEOzP5EmuAmDVVIKxGrxhp7M3BlcMLQ2JHiLN2dloRjM/b2FBv6EEpPuzPJoF ZljLJZwyIn47AQ5bah5WpEKT18I7wvzlp+mmzgMYUWtQATw7WbRV+Ugmr7JsNYQadY8Q bmgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ngcKWrseeZ8ieZPGSI5yc+wVw014s4M+dXDq0q+e1NU=; b=tRFsx4NxS0PGbFSdrJP/HqvcxO3yHW5Sojpkml8ohNWUgEXuq9mT6MY/o9mn06MXWi Ro9a8dGgcMmffNnCfPvJzXQmVFXDlKPq7SBPHaN4aYE35cVQPradVGpS9o9HAZqrsT1w SQY3mhwTuseUa99A+w5h+eNuRIYQP2WEq5Gopml6DGIwG6T7m8SN5vDQib6JC4AGbu5X el9oAHqZ5JwaKmRqttSuxcPAFugo4sdkqcAbC1AtENuDSHDenPObbt2JrKS3bJXZrQpU jCcvreDpTjrm08an8jf/n7ipf+KcSWNiX7L/8Z5+IOBwzTPWiXF6eYQoPzurrIyCQtsD ev4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QBMGIKjb; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a170902900300b0017f791f52c3si17504623plp.88.2023.01.12.19.50.13; Thu, 12 Jan 2023 19:50:20 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=QBMGIKjb; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjAMDXd (ORCPT + 50 others); Thu, 12 Jan 2023 22:23:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232178AbjAMDXN (ORCPT ); Thu, 12 Jan 2023 22:23:13 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5487E12AD8 for ; Thu, 12 Jan 2023 19:22:58 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id d3so22146174plr.10 for ; Thu, 12 Jan 2023 19:22:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ngcKWrseeZ8ieZPGSI5yc+wVw014s4M+dXDq0q+e1NU=; b=QBMGIKjbibfFvRwjHnJUvzsJVAiF6/D1N5uqA1Pj5fjEJk36si6HBmv2tTear2QweW d8v9XV2vNpqIh33PTM+6jJ2ew/Ak2uyCCqqWdZ7We16+W5KS2OUUUjGkzOQensxeh/NQ cngqa6M3fXB/AZYmObdmpwdkkynWic/URqqm9v1QP6FMVutWZCzjqUKb0rxXg2opiRmK 08zEGPtM4BHLM/AuJJAoKhsoaJBziEgYkrrCCs9ofoihmDya4tfJrpKPledEMW0juDvX WVkisPYvunyFIb05dfp/YIfcTi0HZyBLXhwcUGhaKcqkhQF7fAphtQvufWKUChPcWSLQ Q8Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=ngcKWrseeZ8ieZPGSI5yc+wVw014s4M+dXDq0q+e1NU=; b=gZHK01xXEXXStvosCvafn5LNgGIRPZL9CgskiHWAlXzMxTft7ViM4YOgssrh7XdA+h RYwwl1E8qvKe2ZEBqwQiYCGUcwrky0LGUOUEonTIlKb57kn8awK4MajTf+/ZEq60Skf5 UYIzNi0zDfKNVdZXh5zN1M2G/JQ3w6EyKnnwOzpcOGRo1rN68hQKhviTgMqK67PmYUB1 Vx6KE0Ebg7LDpXNx0keqeeCDC41WvyL0J6MQ3mzMb7wR5NDhPY3y3ypINo6lS1j79Jt6 STJZ9tsVf+hVdgXAswv2+AwyXrHkFlKSywxKbZK7cxeYIpBupo6YnVOIhRuUYZF1mK/g /9lA== X-Gm-Message-State: AFqh2kpawu5lcVMtszUTKQM3aWn+NX+DFDCFux3BR9sCR6cdilAlSTPA k2In11hk+G3CtzOsWax1FIzJD6pq603aOchcbxE= X-Received: by 2002:a17:90a:aa17:b0:228:e2f3:5e9a with SMTP id k23-20020a17090aaa1700b00228e2f35e9amr711910pjq.164.1673580177861; Thu, 12 Jan 2023 19:22:57 -0800 (PST) MIME-Version: 1.0 References: <20230111133351.807024-1-jannh@google.com> <20230112085649.gvriasb2t5xwmxkm@box.shutemov.name> <20230113001037.adqha6lxj7lh75at@box.shutemov.name> In-Reply-To: <20230113001037.adqha6lxj7lh75at@box.shutemov.name> From: Yang Shi Date: Thu, 12 Jan 2023 19:22:46 -0800 Message-ID: Subject: Re: [PATCH] mm/khugepaged: Fix ->anon_vma race To: "Kirill A. Shutemov" Cc: Jann Horn , Andrew Morton , linux-mm@kvack.org, "Kirill A. Shutemov" , "Zach O'Keefe" , linux-kernel@vger.kernel.org, David Hildenbrand Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Thu, Jan 12, 2023 at 4:10 PM Kirill A. Shutemov wrote: > > On Thu, Jan 12, 2023 at 10:12:53AM -0800, Yang Shi wrote: > > > This is totally wrong direction. Or I don't understand the race. > > > > > > At this point we already paid nearly all price of of pagetable retraction. > > > I don't see any correctness reason to stop here, except for the assert. > > > > Isn't it possible that collapse_and_free_pmd() clear the pmd which may > > point to a PTE which maps the COW'ed anon page if this race happens? > > No. At this point we have huge page in the place in the page cache and it > is locked. COW fault would serialize on the page lock. Aha, yeah, I missed the page lock. So IIUC even though anon_vma is set there should be not any COW'ed anon pages since cow fault would be blocked by the page lock. If so I tend to agree with you the lockdep assert seems unnecessary. > > -- > Kiryl Shutsemau / Kirill A. Shutemov