Message ID | c73d1543-532c-3da2-8cf2-a95363a14116@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 6C8F7C001DE for <linux-mm@archiver.kernel.org>; Sun, 23 Jul 2023 22:26:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A1256B0071; Sun, 23 Jul 2023 18:26:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82A398D0001; Sun, 23 Jul 2023 18:26:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67C686B0075; Sun, 23 Jul 2023 18:26:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4F5A46B0071 for <linux-mm@kvack.org>; Sun, 23 Jul 2023 18:26:18 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 83C78160853 for <linux-mm@kvack.org>; Sun, 23 Jul 2023 22:26:17 +0000 (UTC) X-FDA: 81044311194.16.4FE1E27 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) by imf12.hostedemail.com (Postfix) with ESMTP id AE0B94000C for <linux-mm@kvack.org>; Sun, 23 Jul 2023 22:26:15 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=iVLb6pAc; spf=pass (imf12.hostedemail.com: domain of hughd@google.com designates 209.85.128.180 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690151175; 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=xrAdJXY/DYoZ1QqZrxUyGx5Ypm1XnUOGUxRagKc/Az8=; b=3NEmFwalF7++THgF5qWpg7zROAVCF7413tZ+pkC1yu1X3oqckK1DJ+gjRqzUaSZAq2fMNp R6C/TPlwrwVzlBP52srycWLqePr59Mrv6JoFUT1NYk+e4sd00sT62rZyrwWRbDkYDtqVk4 /NlVPgwuL0Vm+E9wvwG3gI2DrcMjH+E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690151175; a=rsa-sha256; cv=none; b=J77awy1kfJWd/nFkD+m1kofW+baVwNPsm3ivSAqvYwzuQlXwIRulHRnoub4scLmdKp1tF1 XxicEa6RURnAUECrqmF8Fc0gvrq9dQFk6IqyrRnUBYLd671pO15xlpnUzBNMD9x7/kW0q1 BFB3FGv4rrItEON/xw9TnZYTOcR8mFQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=iVLb6pAc; spf=pass (imf12.hostedemail.com: domain of hughd@google.com designates 209.85.128.180 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-583d63ca1e9so10859457b3.1 for <linux-mm@kvack.org>; Sun, 23 Jul 2023 15:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690151175; x=1690755975; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=xrAdJXY/DYoZ1QqZrxUyGx5Ypm1XnUOGUxRagKc/Az8=; b=iVLb6pAcMPMbH+sKIFDKrp13WE2BH14wgf0sfLLhG3EUD8G/hlzddsk9BjOLwwBDek i4tMCHQWviMOQirYDf83bTCcJPZWFHJR7xkFk3VHd5hC7xG8MCrz4NcetF3qgqDqKUnu xAsV+Rie6eGsL074ig7H7XBphUKKdrVVeh2TIH148CpPb1+P0n1+X7jZdveWNOjVJ6Ba Kp6B7SozJs02j+R5YidTAfbP/CCuxGe3VqDtLCHCvJZKMpIS4f/D4qj/sIim49FJ+8/T kdqRCusHGpxIPd559J2JIVCjJWnkF/KB5ylzgPVROKPwcB7Y5HxAlrSuCa01u6hWj0LC 1Twg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690151175; x=1690755975; 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=xrAdJXY/DYoZ1QqZrxUyGx5Ypm1XnUOGUxRagKc/Az8=; b=AiY+jbjKmStrAF6x1n8eBjDYI1lVluATSa3JaeW5UMx7lGkLTvxaHE36dJU2CY7en/ Dlh8VsST2jJMuNMLmo5UjPIrXY/eprrOQJYC6rtnT08VeMePYCdpT0VjjHM61jvADVTm tlvnDg2AshEJ46tuGZtZsHrD0sSUcnz5bLGc92PIczYf3GoG5Win0KpJJ8LZtNll13Pg WS0h4C/24Yp4AWI6o6DoZ0Uip884ONaVdhTXDvBaXbA8ErLMtPvnl93Laz31n7eyR0PI reA/LzF8VxnsPdbpovUcROm7dwBsxlv/H3sxjM2Aw0InLXFMIhtMvOdOVw74/kCdL0kG mY7g== X-Gm-Message-State: ABy/qLbkht9bg67TPZvztv7vSNailPAs0IFZlJX7ticXzul2wGfz+hr9 fg6ZMZsv8i3EY05ZRZgo+/QbLA== X-Google-Smtp-Source: APBJJlG9iREnJulltCfWnEIqWXVGbxKFPc9M2vviU+KVFolzwpucWCLcuiZJ3CMHwTth2+2e2Ovuug== X-Received: by 2002:a81:7d88:0:b0:583:9018:6fbb with SMTP id y130-20020a817d88000000b0058390186fbbmr5157782ywc.37.1690151174666; Sun, 23 Jul 2023 15:26:14 -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 n124-20020a817282000000b00573898fb12bsm78328ywc.82.2023.07.23.15.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jul 2023 15:26:13 -0700 (PDT) Date: Sun, 23 Jul 2023 15:26:02 -0700 (PDT) From: Hugh Dickins <hughd@google.com> X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton <akpm@linux-foundation.org> cc: Jay Patel <jaypatel@linux.ibm.com>, Aneesh Kumar K V <aneesh.kumar@linux.ibm.com>, Hugh Dickins <hughd@google.com>, Miaohe Lin <linmiaohe@huawei.com>, David Hildenbrand <david@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Yang Shi <shy828301@gmail.com>, Peter Xu <peterx@redhat.com>, linux-kernel@vger.kernel.org, Song Liu <song@kernel.org>, sparclinux@vger.kernel.org, Alexander Gordeev <agordeev@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Will Deacon <will@kernel.org>, linux-s390@vger.kernel.org, Yu Zhao <yuzhao@google.com>, Ira Weiny <ira.weiny@intel.com>, Alistair Popple <apopple@nvidia.com>, Russell King <linux@armlinux.org.uk>, Matthew Wilcox <willy@infradead.org>, Steven Price <steven.price@arm.com>, Christoph Hellwig <hch@infradead.org>, Jason Gunthorpe <jgg@ziepe.ca>, linux-arm-kernel@lists.infradead.org, Zi Yan <ziy@nvidia.com>, Huang Ying <ying.huang@intel.com>, Axel Rasmussen <axelrasmussen@google.com>, Gerald Schaefer <gerald.schaefer@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Thomas Hellstrom <thomas.hellstrom@linux.intel.com>, Ralph Camp bell <rcampbell@nvidia.com>, Pasha Tatashin <pasha.tatashin@soleen.com>, Vasily Gorbik <gor@linux.ibm.com>, Anshuman Khandual <anshuman.khandual@arm.com>, Heiko Carstens <hca@linux.ibm.com>, Qi Zheng <zhengqi.arch@bytedance.com>, Suren Baghdasaryan <surenb@google.com>, Vlastimil Babka <vbabka@suse.cz>, SeongJae Park <sj@kernel.org>, Lorenzo Stoakes <lstoakes@gmail.com>, Jann Horn <jannh@google.com>, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Naoya Horiguchi <naoya.horiguchi@nec.com>, Zack Rusin <zackr@vmware.com>, Vishal Moola <vishal.moola@gmail.com>, Minchan Kim <minchan@kernel.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Mel Gorman <mgorman@techsingularity.net>, "David S. Miller" <davem@davemloft.net>, Mike Rapoport <rppt@kernel.org>, Mike Kravetz <mike.kravetz@oracle.com> Subject: [PATCH v3 04/13 fix] powerpc: assert_pte_locked() use pte_offset_map_nolock(): fix In-Reply-To: <20230721131341.w5abuxcbohofpzwa@patel> Message-ID: <c73d1543-532c-3da2-8cf2-a95363a14116@google.com> References: <7cd843a9-aa80-14f-5eb2-33427363c20@google.com> <e8d56c95-c132-a82e-5f5f-7bb1b738b057@google.com> <87msztbiy8.fsf@linux.ibm.com> <392f311f-83ac-a5a2-d16e-2c7736d1b577@google.com> <6762c880-6d2b-233f-6786-7ad5b0472dc7@linux.ibm.com> <20230721131341.w5abuxcbohofpzwa@patel> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: AE0B94000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: wcyt7hjytezbnwpbcw3hmt58ymh1gaq1 X-HE-Tag: 1690151175-296777 X-HE-Meta: U2FsdGVkX18tCaH8ilxqqANWGDsk1bp9KxtVdVr7be//dLEUwzf5N37Kza+Q/nTQYs6S/mEmN20KbUaMFgh6kGo/PudBzA+icTEvKoQFNlNAsPWqBL+m2y6cU9RXBW/cQUVwbEvKkA5t3yoNk9Kju99zf6HV8YiWxVtsy6LsdDtr1/Ur8yAEZYVZ4t3wU9JhcVQ/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6zhmI8FEhd+nshzcDoTAIBSZKfUxkAEmuvF/E9f5mCrc2XMlzShu0UDS6ildA1ragS9S8wyAiflU2vgzOiME+8yWfARoWlFbNA5bm0lvtUdLr3lGU9fJKzb3ZITmyvYBwY43erXiSYHAlQKxhB6PGzBsKQz2dTGIuALTwpJAYkzzVH+A37+C/59kj9jl/jXyNfjRKNemeYf7duHk2LYkDranWsKXZpg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
None
|
expand
|
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index 16b061af86d7..a3dcdb2d5b4b 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -323,6 +323,14 @@ void assert_pte_locked(struct mm_struct *mm, unsigned long addr) pud = pud_offset(p4d, addr); BUG_ON(pud_none(*pud)); pmd = pmd_offset(pud, addr); + /* + * khugepaged to collapse normal pages to hugepage, first set + * pmd to none to force page fault/gup to take mmap_lock. After + * pmd is set to none, we do a pte_clear which does this assertion + * so if we find pmd none, return. + */ + if (pmd_none(*pmd)) + return; pte = pte_offset_map_nolock(mm, pmd, addr, &ptl); BUG_ON(!pte); assert_spin_locked(ptl);
Aneesh points out that assert_pte_locked() still needs the pmd_none() check, to stop crashing in khugepaged: restore that comment and check. Andrew, when merging with original commit, please edit its 1st para to: Instead of pte_lockptr(), use the recently added pte_offset_map_nolock() in assert_pte_locked(). BUG if pte_offset_map_nolock() fails. Signed-off-by: Hugh Dickins <hughd@google.com> --- arch/powerpc/mm/pgtable.c | 8 ++++++++ 1 file changed, 8 insertions(+)