From patchwork Sun Aug 6 03:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13342738 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 0EA8BC0015E for ; Sun, 6 Aug 2023 03:59:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 872B98D0002; Sat, 5 Aug 2023 23:59:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 823188D0001; Sat, 5 Aug 2023 23:59:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6EA168D0002; Sat, 5 Aug 2023 23:59:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5F0358D0001 for ; Sat, 5 Aug 2023 23:59:36 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2602B140275 for ; Sun, 6 Aug 2023 03:59:36 +0000 (UTC) X-FDA: 81092325552.24.CFCCF62 Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) by imf17.hostedemail.com (Postfix) with ESMTP id 4DBA340003 for ; Sun, 6 Aug 2023 03:59:34 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="fPoU/fRu"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of hughd@google.com designates 209.85.128.182 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691294374; 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=lrjEl367R/y3HI+4JKvQ0DDl1pq1Lit9a0Zn8ubupwU=; b=h3wxOAftnnqcd5M+8hHK55XfYf6uV9Al1b//504Ac3gI6p86+sQ0QmPo/Cp+BNJ5jR4q0h 2dEE44nrKQOj7i7WnJ4WNuAKLymPluZjY3PlOr5LbH8mwoSytweAQPB9g1ylp4BLGlut0N cVFUpKKLmUlx3NlvNwouqK6xag5AxlU= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="fPoU/fRu"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of hughd@google.com designates 209.85.128.182 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691294374; a=rsa-sha256; cv=none; b=3lMfiZFf+GFHE3mvwI2VB33rF3I+kqKTHXXqUqaS3aXwvc4v4DGHh0oCwb8ZWV/Hkwx08m N389r5KLlKpxHZwTiQYreGXCn7d2YaAAGRdMeBNigo53+WY1jpOSyoRYzrTj00q1V4/7pS uA5Zyco0Zprkks7pofOutwKzji2oIZA= Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-586b78aa26eso15696607b3.1 for ; Sat, 05 Aug 2023 20:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691294373; x=1691899173; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=lrjEl367R/y3HI+4JKvQ0DDl1pq1Lit9a0Zn8ubupwU=; b=fPoU/fRuHX5caeTxQNTi6xCx7rooozWVX8OCkvcRFbiVcZeihuuZZlQmHVtAw45YAU kFT79lh292tEMsPH0yFic9OWUawFTESm7xFiS7iMD5hNLVpkpBLE1WwEzPp8KYPc9FvH 766vba+m+Ozk/SUm7hZshVAuKp3hxt+fVNapmNcBwnLA8Tu4o53ObK+EGCiIS1gfH4rG uel9HuMTx0Oe+VPeKFnHbRMjn+5QkVxnK6oa0BwRKKK/2LR8eKx9092x6l95LvzWPB4R /SFh7mg0lNI5CkVsjDsRo/ouKCF7FXkkPaU6nGGyY8dfVtlmJW+KmCWlykivefXbbzzJ QLIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691294373; x=1691899173; 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=lrjEl367R/y3HI+4JKvQ0DDl1pq1Lit9a0Zn8ubupwU=; b=N/vq+weKJUd+Uz8qPtB4I8oO8unCPQT8+16L2Ry7XG046YhHsVLDvjVVCVgbVrN8Vp JNA9HcNllkQXxFvlz9FKZdllLpOIMVkXmUXewDCrhzv+oRMjYicTggbwbYv21QF1AZS2 euA2TgKRQZwBoQK8AXDv0iIl24t6hMfC1Y1nngRBvx6Xib+Vj1d4m109uedaOp9iHrQD WJm0xdSBRrT5yRjRun4CkOKTHEOPKwkXUpxtP/fqpaGekAV9NYfvYcCiCa/7h6lYzoHv fGYhR9JPKmQsZVMSNsdLbtGkMlxlKh3rfXF4kFc+POghAwhO+6EFAX2P/jsJpzuaqrEF ZMHg== X-Gm-Message-State: AOJu0Yx8qCMhpalM/PaRefZoRoFA1uLIU0uZI3Xi2FA/6VJ8i0Vsr0M9 ZMVoLePR2qFWDWmtOrgC7yDlOg== X-Google-Smtp-Source: AGHT+IEL/z5m+be82hvNIbgvVlYv0KrLIPiuRdrdQbyoEcvhg0nO6N3eCW4FBoXQZBwSKC83ZFZFiw== X-Received: by 2002:a0d:e253:0:b0:584:189c:13ec with SMTP id l80-20020a0de253000000b00584189c13ecmr5953081ywe.21.1691294373186; Sat, 05 Aug 2023 20:59:33 -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 p6-20020a815b06000000b00584554be59dsm1887384ywb.85.2023.08.05.20.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Aug 2023 20:59:32 -0700 (PDT) Date: Sat, 5 Aug 2023 20:59:27 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Qi Zheng , Hugh Dickins , Pasha Tatashin , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Lorenzo Stoakes , Huang Ying , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Jason Gunthorpe , Axel Rasmussen , Anshuman Khandual , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , Russell King , "David S. Miller" , Michael Ellerman , "Aneesh Kumar K.V" , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , Gerald Schaefer , Vasily Gorbik , Jann Horn , Vishal Moola , Vlastimil Babka , Zi Yan , linux-arm-kernel@lists.infradead.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 10/13 fix2] mm/khugepaged: collapse_pte_mapped_thp() with mmap_read_lock(): fix2 In-Reply-To: <0df84f9f-e9b0-80b1-4c9e-95abc1a73a96@bytedance.com> Message-ID: References: <7cd843a9-aa80-14f-5eb2-33427363c20@google.com> <0df84f9f-e9b0-80b1-4c9e-95abc1a73a96@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4DBA340003 X-Stat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2IUWG/1Qk1dJzYt9yVV0M3AuJKYxZub06E+yhQKLGZD5P0gkDHzg3uCGYkoJZF3V54TDstG1kiymTBFdjehTKI6tVtsmDLuP277VE0in7zQ6f85oE3HddKBCl/KC/jaKmu9dUpVkHHF+AxpHlt8cRyegprjEp8znbO66W/bN6E7oLZTZmvhiU+LJsTxJ5B55oV/D7P0y90xvHzVx/rNu9r1F1bIVrP0GYodkVz0eMDQ+qqKszUtN+B0HWQ0qopt2KQu159VX44bZWy6fgSdUFp51Z+Lok1l3Cjj83W6gzHZlOd+HFaoP45qcyXNWX+LG7WazrvsHSQ/Ug7X082vKfBehGiADeTp8ygVU07cDwZtA745WEjTy7BOKfnMb0XQV6Qd7clkUNpNYo3151E/Lz/r864l+y8eMKmCb2OxeTIp7XyBk28uDFssw+9p4qGZ3j1JLYy2OTnWNLspk8VK4wwZwra+MO8gwK9DchHQWViW58PL9YE5EKjsf0tZd3wHSuM/KMETNPgpigNUIN1DvAiXQNQhMwY//9TPTroUCWIupTR9CZO0jNRDrCF0t/pvpVqye/VR9k5v8u2RASXgA2Mf6E9k= 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: Use ptep_clear() instead of pte_clear(): when CONFIG_PAGE_TABLE_CHECK=y, ptep_clear() adds some accounting, missing which would cause a BUG later. Signed-off-by: Hugh Dickins Reported-by: Qi Zheng Closes: https://lore.kernel.org/linux-mm/0df84f9f-e9b0-80b1-4c9e-95abc1a73a96@bytedance.com/ --- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index bb76a5d454de..78fc1a24a1cc 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1603,7 +1603,7 @@ int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr, * TLB flush can be left until pmdp_collapse_flush() does it. * PTE dirty? Shmem page is already dirty; file is read-only. */ - pte_clear(mm, addr, pte); + ptep_clear(mm, addr, pte); page_remove_rmap(page, vma, false); nr_ptes++; }