Message ID | cafe6ccf-6fee-999-5e1-7963cd529d9@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 88905C7EE23 for <linux-mm@archiver.kernel.org>; Mon, 22 May 2023 05:03:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D0ED90000B; Mon, 22 May 2023 01:03:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2805E900002; Mon, 22 May 2023 01:03:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FAA390000B; Mon, 22 May 2023 01:03:13 -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 F0447900002 for <linux-mm@kvack.org>; Mon, 22 May 2023 01:03:12 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BEC5F16042D for <linux-mm@kvack.org>; Mon, 22 May 2023 05:03:12 +0000 (UTC) X-FDA: 80816697024.25.BCA210B Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) by imf03.hostedemail.com (Postfix) with ESMTP id DE7932000A for <linux-mm@kvack.org>; Mon, 22 May 2023 05:03:10 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="Kc//GQWt"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of hughd@google.com designates 209.85.219.180 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=1684731790; 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=W3t6elq9R4Rh1GonIcnIp9HMVNr0t0fb96tM78h+6lY=; b=5ZjIvgWN2X1oxTOekAmJ6uFfJ8bH8aDlz+fccXxWy38HYApExd0Km/FV4fOp7vk5e3tMgp Mmebmuba/66v+nOnMLErEMX1tFNqlnCoF98ayUI1W6sjmKBWxGxloWJDBFlXnqcg9AypIy ep+9J1S/OQ6KjHI0m87lZIf594j0HhM= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="Kc//GQWt"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of hughd@google.com designates 209.85.219.180 as permitted sender) smtp.mailfrom=hughd@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684731790; a=rsa-sha256; cv=none; b=Yd8EoXHVgcDCEOW1WR42nppHP/Rlo6PNZKCStkE2KhcX0w50lKX66T00qWYEcQbCw1s/9+ em05HXnSL1mPGrU5j46lZZ5QWzAi/tuJws9Na5deM1i/8l436mo2ZUnEXzDnReGJhrKgYz B/MCJOWqztGW2G9rJNKH9w0ab2w0JBk= Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-ba827a34ba8so8243189276.0 for <linux-mm@kvack.org>; Sun, 21 May 2023 22:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684731790; x=1687323790; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=W3t6elq9R4Rh1GonIcnIp9HMVNr0t0fb96tM78h+6lY=; b=Kc//GQWtdcYt13ahGjffwsLxy+Q5bVB6WROYwiSc3JojtgWwDe3izjSyHuE6U0IG/O 5Fry5zLgCWeTO19pC/0eYwlnvGNsyrmto6ZIBbyVNO56nsRvrMOAOUvYspI147xhZOi+ xqdX2iixj9Eo1KLPuK7IDQx9rj9ZoPh6D5XKx6tya/9I/bhzim+Yk6xTIzKBifA2beI4 8qMCGwFCGRwoHjLeW/d0tZsZvr4CJThANuX9SXUFpqX1pEid4ilFDqnQwxhHJZTeMBQb PwATHquSI9R4s4VAZXrMlE6dKgd4X76gX9zjTUT4KksMHQf4ahMKcn/OqGVTbmF1mVyt 4G7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684731790; x=1687323790; 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=W3t6elq9R4Rh1GonIcnIp9HMVNr0t0fb96tM78h+6lY=; b=AphhRIyq7Zt7/5CgYPsD/Cra24M23KbhDJqKbQFcMpdV0C/XvjYOlWGSlSL5mZs/MS oXxrN7hzHJDdjISxV8KKhNOrywPc+FQjlWARStgnfyuUAmlZN7QTGMxg/QUmRecCyw1S VN2oRUqQuve31PkSvPqvNE3hexEkfmVkonk4l/LoIGLvEqqa9ZIf88L0zzlMqbTCB+ow sRla+V1J+AQeydEPqnTh/KPeeS6DnzmuB99SplwkY6hJ+l/CrdgFo8oIb1NCKb9PPwkm Tk0CufKzaYX2wMD+fZLoCogAwahBkeL8JcPDTurix8AYnIi5PyyMc6ULboW23m6i1+5p vdqA== X-Gm-Message-State: AC+VfDxv3az/RJFPx4yb82dlwilzMI0gU483YJ+ObWNaT28OHhimt9fW x0ZCiT47rA7gG+4EY6I6BF4tsw== X-Google-Smtp-Source: ACHHUZ6OdnTYy1GhoQl2g/GfXGTjIkyQzrSYRsCypiToKGf2HILo2risNfGACl3kmPaMyL1d5bYIVQ== X-Received: by 2002:a25:aaac:0:b0:bab:eb8b:c484 with SMTP id t41-20020a25aaac000000b00babeb8bc484mr2926154ybi.14.1684731789855; Sun, 21 May 2023 22:03:09 -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 e6-20020a25b046000000b00ba73c26f0d6sm1322602ybj.15.2023.05.21.22.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 May 2023 22:03:09 -0700 (PDT) Date: Sun, 21 May 2023 22:03:06 -0700 (PDT) From: Hugh Dickins <hughd@google.com> X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton <akpm@linux-foundation.org> cc: Mike Kravetz <mike.kravetz@oracle.com>, Mike Rapoport <rppt@kernel.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Matthew Wilcox <willy@infradead.org>, David Hildenbrand <david@redhat.com>, Suren Baghdasaryan <surenb@google.com>, Qi Zheng <zhengqi.arch@bytedance.com>, Yang Shi <shy828301@gmail.com>, Mel Gorman <mgorman@techsingularity.net>, Peter Xu <peterx@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Will Deacon <will@kernel.org>, Yu Zhao <yuzhao@google.com>, Alistair Popple <apopple@nvidia.com>, Ralph Campbell <rcampbell@nvidia.com>, Ira Weiny <ira.weiny@intel.com>, Steven Price <steven.price@arm.com>, SeongJae Park <sj@kernel.org>, Naoya Horiguchi <naoya.horiguchi@nec.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, Zack Rusin <zackr@vmware.com>, Jason Gunthorpe <jgg@ziepe.ca>, Axel Rasmussen <axelrasmussen@google.com>, Anshuman Khandual <anshuman.khandual@arm.com>, Pasha Tatashin <pasha.tatashin@soleen.com>, Miaohe Lin <linmiaohe@huawei.com>, Minchan Kim <minchan@kernel.org>, Christoph Hellwig <hch@infradead.org>, Song Liu <song@kernel.org>, Thomas Hellstrom <thomas.hellstrom@linux.intel.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 11/31] mm/vmwgfx: simplify pmd & pud mapping dirty helpers In-Reply-To: <68a97fbe-5c1e-7ac6-72c-7b9c6290b370@google.com> Message-ID: <cafe6ccf-6fee-999-5e1-7963cd529d9@google.com> References: <68a97fbe-5c1e-7ac6-72c-7b9c6290b370@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: DE7932000A X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 8s9w91h4oo7zxada1h7afteqjo61akt8 X-HE-Tag: 1684731790-404926 X-HE-Meta: U2FsdGVkX1+Zi30tWp/V6PkjUOluRUl180O2AKbmaLDlXwHMTfQHvd70e17Ap9yJ5MsMbzprIIrrZQn5YtolJcdMAheu/6bZPkWj4qKj1jPJDfc8bRCRE5Re+6gfo0Jcuwb22RMhSeB8+qx2Yz/EFClXUK0pHkB0cW59SBSy5p4NvgDcvHYCmwwNjJvdMVZ7JNJaR61Aj2kLtkKKkrVoV7jHZs7Do18sXZfaZnlG264d8U+cz5BYZ2fzeeKGj4iPh4KWeXFpZRbsbPrNld1dxh1B5Nnt9+fgjvogZtBXVXYtw1eibbBRDOBeCpwh7QG7Fr+y/hiOl6LoNaGwCOZ55onvdrb3ohcXDzzLLoFiVhntRYl1V7/+/1DEDn3WyxKBcZPI+Vw/WmzBI7N8og6D6PnFb/h6KC/bXFRKKW4zfMYO3+P99BFnkmWnooITih12GgWSaRI+/vhzhreQhSrhvTE83rpb6ficq7GfMq2oMbNgrpC9hwsn9ZRbPltZ9fhI403ndAg1YaaLyeiON9AmHpWRtfuI3OBR5Qg2o3Hq4VzN//UALy+fia2XuL0aD2eRK+/aDU2aluHlVF7FsaTM6NvBp/iLAmFSL2kqTiTHCRTOMQ0yOLK6Z64JhoxrJdTCUa01hBFJwJEdugsRf3mtndheoe2dSWkgZ94w3DOKtWPMlaq+EqHkO28evjfECicEjp9Sx91MgYRssu8HrhIRI/E2S+dH31ypFvviOgCVtEfgSgw6/vxAi10jCgtyUnFf3gjKvnW4eCIbGsSm9BAIq10KUVfNsphZyBThKahScJknNvWxNDH7HK6bFJWqBNGJNT0/SLUZMS5yOht58DE9cg/l2juBPFWO1pgzi2tyNxk3YgxXCxb6lJQt/UlZbhFBxTai3A+11xmL6ozkX+dskxMdGb1iv23+ugAfJoN/DRSofePqAFP1sxLNE+5vS1g5pVS904z8f3JH3bQy3iC HS/5Wy4K ZshQoZpS05b1lI/Tt/MNo8li8wEIEcKCteWMyajUkmAuk9LJwe5zdqH3Ee1m2PoP2B9kRUGwhCdQjCi2kJXzhbL/kQ4LE2u+5vEfYRiTb3qG+K5TOLgHFj4qpbU6lrF90Y2BWE7MPaQdVjaZvJ8uOaDrJPltbBSsqv3msAQMRVqMjGZHt16iIyvhhceV95To5bB6fYVSb0Jzdw5QBmIh/98iOv6B5PwBnUNcEbkhwjMEH/LNal3TYGPtp4bCBf+ji/F9542r5g9QB+8S3liccsEGJSPfQV53yqm06hVPjETRbeCdFFipsQWYT1lIAneRY4ZTHmDN6gh7P3cMx9T6mk/79UpGYaaXCo1hW6aSyzeQvwhRhKGuFLJT0Sb8DSjSfuIG2 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 |
mm: allow pte_offset_map[_lock]() to fail
|
expand
|
diff --git a/mm/mapping_dirty_helpers.c b/mm/mapping_dirty_helpers.c index e1eb33f49059..87b4beeda4fa 100644 --- a/mm/mapping_dirty_helpers.c +++ b/mm/mapping_dirty_helpers.c @@ -128,19 +128,11 @@ static int wp_clean_pmd_entry(pmd_t *pmd, unsigned long addr, unsigned long end, { pmd_t pmdval = pmdp_get_lockless(pmd); - if (!pmd_trans_unstable(&pmdval)) - return 0; - - if (pmd_none(pmdval)) { - walk->action = ACTION_AGAIN; - return 0; - } - - /* Huge pmd, present or migrated */ - walk->action = ACTION_CONTINUE; - if (pmd_trans_huge(pmdval) || pmd_devmap(pmdval)) + /* Do not split a huge pmd, present or migrated */ + if (pmd_trans_huge(pmdval) || pmd_devmap(pmdval)) { WARN_ON(pmd_write(pmdval) || pmd_dirty(pmdval)); - + walk->action = ACTION_CONTINUE; + } return 0; } @@ -156,23 +148,15 @@ static int wp_clean_pmd_entry(pmd_t *pmd, unsigned long addr, unsigned long end, static int wp_clean_pud_entry(pud_t *pud, unsigned long addr, unsigned long end, struct mm_walk *walk) { +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD pud_t pudval = READ_ONCE(*pud); - if (!pud_trans_unstable(&pudval)) - return 0; - - if (pud_none(pudval)) { - walk->action = ACTION_AGAIN; - return 0; - } - -#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD - /* Huge pud */ - walk->action = ACTION_CONTINUE; - if (pud_trans_huge(pudval) || pud_devmap(pudval)) + /* Do not split a huge pud */ + if (pud_trans_huge(pudval) || pud_devmap(pudval)) { WARN_ON(pud_write(pudval) || pud_dirty(pudval)); + walk->action = ACTION_CONTINUE; + } #endif - return 0; }
wp_clean_pmd_entry() need not check pmd_trans_unstable() or pmd_none(), wp_clean_pud_entry() need not check pud_trans_unstable() or pud_none(): it's just the ACTION_CONTINUE when trans_huge or devmap that's needed to prevent splitting, and we're hoping to remove pmd_trans_unstable(). Is that PUD #ifdef necessary? Maybe some configs are missing a stub. Signed-off-by: Hugh Dickins <hughd@google.com> --- mm/mapping_dirty_helpers.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-)