From patchwork Fri Jun 2 23:05:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 102718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1365089vqr; Fri, 2 Jun 2023 16:35:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Hr/p3g1Jn1ftl+wjkGfnTsmrw1HPTdJu4UDRF5zx1EaFcHpgZ2+lUtdvcU1i2kPv3JkZI X-Received: by 2002:a17:902:8684:b0:1b0:6544:1d4 with SMTP id g4-20020a170902868400b001b0654401d4mr1170317plo.27.1685748907772; Fri, 02 Jun 2023 16:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685748907; cv=none; d=google.com; s=arc-20160816; b=U9/ms3QzyrLB/5twylRmnSXne3ZoHrdCaFuWiXCFk2C5ogkFT9D5nTjgTYe7kiNWHc P29cKF5Vfqf5oOqxNXqIrhx3mgfYM+Nyh5ZVFI11+Wa7nO2cwMdNxtn5mduQ2R4kERBB +fPE48qaWTpvIsgE+kQRiDDJbdAyqDk0RuBkHGpdcqbHtaEmK4/HPFD0UEd7WUY6Md7g qJ2xKgsyH3I/+mVP9+VbJUDkw93HYe0ZKrLnn6DDGQgV54h3iKlNm3QviFT6DSVqhHSx Ng16+7bktp7RDPzKXIFfdpQjHwuGpzqk2aHX/aCbm39936PHKLbgdD/QgHP8/0E+RNi0 hlOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7/N76tvOnLlaQAuSL3pN8eRsyONhrct8MBiAnZh2TuI=; b=l9wM8PBla41v2ax9Ju5fz9Svq3OifVvC2aypCqpt1/KImjNXudLD6aJGAPNaAIPfko rPdOdxFMsEVqExhPISD5HoS4/F6RsCd5h9x+nHOAwiyBjjaar36wGk/XVH4bVjz5oKV+ jYee05ooqcU0BMcY7UxOvjeOOixVJfuky5/QyozzQJE6EGPeE8PJngsDxGxza3ZScldu l0YCPeBMmRqUugfZuguswTdRTy/HduK7WS3SV12djJF4CcA1Vi1Vm7tsSUajFuBBznip BqRS8+wYnuF6QKThg2b84viWuSqRNGQ3Eh8F6BNXk8B4RJaNWbdivQBWwccYLzK7X91v Wq1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h087KohY; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a170902b78600b001ae3cb42bfdsi1485150pls.634.2023.06.02.16.34.55; Fri, 02 Jun 2023 16:35: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=@redhat.com header.s=mimecast20190719 header.b=h087KohY; 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 S236811AbjFBXG5 (ORCPT + 99 others); Fri, 2 Jun 2023 19:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236799AbjFBXGv (ORCPT ); Fri, 2 Jun 2023 19:06:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96886E42 for ; Fri, 2 Jun 2023 16:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685747165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7/N76tvOnLlaQAuSL3pN8eRsyONhrct8MBiAnZh2TuI=; b=h087KohY/9Zk9c75R/dGcIsgkLLMfhctZS6UBnp1D5BgCWuvn4B1TtjU1vEyuPYO1cOY7H qqUbedAEGMO2h8G6opHop4CwP2sC8eaD1WpN4I6Pyh9d49fn/xEy4hBru0aQ0aQhoHMGAT kC/i3cFfoqZd9Us07EDM6mO7S0xUx6M= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-rNkeITVuMGi6grhx4f1C2A-1; Fri, 02 Jun 2023 19:06:05 -0400 X-MC-Unique: rNkeITVuMGi6grhx4f1C2A-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-3f6b46e281eso3409491cf.0 for ; Fri, 02 Jun 2023 16:06:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685747164; x=1688339164; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7/N76tvOnLlaQAuSL3pN8eRsyONhrct8MBiAnZh2TuI=; b=aEd/DYkU0Rj2K0wfTT+pQpeRKlwGMseKpAGwrHs4xvUxngTvbrjJSockYWEAhtFNe5 DugE2DAfJhNrJ5yOsaEaV2HQXHTpvTiqpt5JvTvxhV7hXme61plLuiT1CGN2L/WLQLMm l5To6mbVUvO6hyzOV2HsUeTa7BnuQP9Gi+ktB5dmfexzV6ABzyCaU33h4mt1lTj3aOJz 3qPodjmw7gkmc691d1yhJhw4FAALbvEsutePjtWEPO55jAwT+RbzvG/TfmPSOWhaF6f1 MIEpcpSh++QzzE4LmIGVpZS4yRx5IU3q0T01o9BGWpMxfXPHjGbRsNAtF/x7N0mx2HOl H2eA== X-Gm-Message-State: AC+VfDz+4XdPJg9voqAlMUn44FhCEc8uKXEh/9rDD0aHqXJkxOU1MdAk 6kK+UQBphq2urOxEBP9aaOwePXcXLTpesX407yZpMqaEA9obIsBnt1wn8Mm7+2fz5cif0/vV475 PyyPv5pIpEmHMDNA36mT1NiXLdGI7M7br691PTB0Y9DcEAMKDzwQCS0dWrQaT23EF2SCRw5oIgl 6J+lrerw== X-Received: by 2002:a05:6214:21a5:b0:621:bf0:7609 with SMTP id t5-20020a05621421a500b006210bf07609mr13309574qvc.0.1685747163782; Fri, 02 Jun 2023 16:06:03 -0700 (PDT) X-Received: by 2002:a05:6214:21a5:b0:621:bf0:7609 with SMTP id t5-20020a05621421a500b006210bf07609mr13309535qvc.0.1685747163387; Fri, 02 Jun 2023 16:06:03 -0700 (PDT) Received: from x1n.. (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id px13-20020a056214050d00b0062607ea6d01sm1400792qvb.50.2023.06.02.16.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 16:06:02 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: David Hildenbrand , Alistair Popple , Andrew Morton , Andrea Arcangeli , "Kirill A . Shutemov" , Johannes Weiner , John Hubbard , Naoya Horiguchi , peterx@redhat.com, Muhammad Usama Anjum , Hugh Dickins , Mike Rapoport Subject: [PATCH 3/4] mm: Warn for unstable pmd in move_page_tables() Date: Fri, 2 Jun 2023 19:05:51 -0400 Message-Id: <20230602230552.350731-4-peterx@redhat.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230602230552.350731-1-peterx@redhat.com> References: <20230602230552.350731-1-peterx@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767635846878048643?= X-GMAIL-MSGID: =?utf-8?q?1767635846878048643?= We already hold write mmap lock here, not possible to trigger unstable pmd. Make it a WARN_ON_ONCE instead. Cc: Naoya Horiguchi Signed-off-by: Peter Xu --- mm/mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mremap.c b/mm/mremap.c index da107f2c71bf..9303e4da4e7f 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -544,8 +544,8 @@ unsigned long move_page_tables(struct vm_area_struct *vma, old_pmd, new_pmd, need_rmap_locks)) continue; split_huge_pmd(vma, old_pmd, old_addr); - if (pmd_trans_unstable(old_pmd)) - continue; + /* We're with the mmap write lock, not possible to happen */ + WARN_ON_ONCE(pmd_trans_unstable(old_pmd)); } else if (IS_ENABLED(CONFIG_HAVE_MOVE_PMD) && extent == PMD_SIZE) { /*