Message ID | 20240904084022.32728-3-zhengqi.arch@bytedance.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 AFDD5CA0ED3 for <linux-mm@archiver.kernel.org>; Wed, 4 Sep 2024 08:41:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3DDE46B026D; Wed, 4 Sep 2024 04:41:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 365DC6B026E; Wed, 4 Sep 2024 04:41:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E05A6B0270; Wed, 4 Sep 2024 04:41:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id EC3B76B026D for <linux-mm@kvack.org>; Wed, 4 Sep 2024 04:40:59 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 88FC6120D6B for <linux-mm@kvack.org>; Wed, 4 Sep 2024 08:40:59 +0000 (UTC) X-FDA: 82526410638.04.F328DDD Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf27.hostedemail.com (Postfix) with ESMTP id B5F9540008 for <linux-mm@kvack.org>; Wed, 4 Sep 2024 08:40:57 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=BAV6KZch; spf=pass (imf27.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725439162; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=H/kyF9mn9oESktxWYdr3s8d2VJ5iyYEZZY3E5BXrvv8=; b=8IsHVunURBb3t17PU5vDa3NeWmoEGwgE1GNyhO69dnWcti20jMoxdxoOwwMkW29MaRDcec w636S88lnkHynmQgOLTXTeXXUzGtvP/7J6/6gcL3IJrc4jQ6V1UQwpLYT1UmS3EoI9wVad b4b6d4ZC83ukEqKPNNnJmlxC6ZrHkcg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725439162; a=rsa-sha256; cv=none; b=vhcI2wBpbHVbBxcQa0jBMJ4VQ7EsHncp73lqa774Yf2lAQHnBDZC7loXuk7tQFo98e+hgB bdumYMkoTFpuzJV76oMmOImBG7spRnoYrqn7DDq4PFoQoeFI6FXpp97lTvYfL7t1f+yu5L BZC4qf3JrhZDUjJ6MLobnZ8JrGyZzwM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=BAV6KZch; spf=pass (imf27.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-206aee4073cso6770365ad.1 for <linux-mm@kvack.org>; Wed, 04 Sep 2024 01:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1725439256; x=1726044056; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H/kyF9mn9oESktxWYdr3s8d2VJ5iyYEZZY3E5BXrvv8=; b=BAV6KZchmI72kPqAFdGm+CTB87yfHpb+3u2UmRVnRHVnmiZe7rTXaZmFk1ChansKTL BhJEZw8jZUyPf77Y7UxoejKu76CX2NXA5+vaA1g9RpLe4sp8qObNsYkWQqBwdMif1mn5 AjO/V+K/pa54HkoQN5zSJv3oqj/m6B1MQVnZhJRGEIXsduP5hbZY43pkfGUhZ2yh3ZCm hQIxfG80r9K8W1yI75uZHlQksIkzjmiD5kBQE2PgCfsNeuKZlOf8nfskiQXjS7Vs002m 462/eh90utAybc1qc2X83bwyawfjMC4zoJwvp/tXR1fPFYApHE4Kj7iEFBdQwSklm6YL FSsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725439256; x=1726044056; 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=H/kyF9mn9oESktxWYdr3s8d2VJ5iyYEZZY3E5BXrvv8=; b=HTA5wo8U3YigXYsgJ7TPHQMMK9wCR/N2gn0Hq+qfxyhMLULQ3Xo5QGPon1J37KQiNH wfVEnyuOfR0MvqEF96BdZ5sIqeZxJj+3PLJOvr9ddio4WQxTN+QCoWUJBZ4qYt6PXo02 jymyBkOi6SacpylaoAtmLMXWcoqV1tjFNcnvMPwtmB+3VQQ2x7+VJBb9xD4o72ME+VOK 20PSsSTvd2150SzG25XbxY9BRjS6mZVEX78LTugZHXq/nXJYVET5rWUo4rdDGoBLHIBZ uzPUw6G4Ce1NM6+dSDekHmDJRH9SIrvA8XYCU7RJVSf6iceHSifYlpDKTQhBT9mL1chP eYzg== X-Forwarded-Encrypted: i=1; AJvYcCWL0Oh/SlXyL7Okik3hm4jaEEp8QwYfSi/qJvA+46bnkeb6UP1LXrGyhgd9ZeJ9JIwTlLpQcKdufA==@kvack.org X-Gm-Message-State: AOJu0YyQ8J1GUIes+MN7hQ2J3HJAuPTkJCL8hZzQkBLEmc2c1kP9OnAU 4sWwhgHhFo0/FQLZy5P0350DIOWDotylV2Foo4ArxLKiy2n0hkdNO0qnowBJ4hI= X-Google-Smtp-Source: AGHT+IEEdhBdCGQBBk6sF5V8bi+PhpxKTNotIZgwSj7kMgQxLZV/04loActQGvyTL5xDqZZl1Kbj6A== X-Received: by 2002:a17:902:f547:b0:206:b618:1d7f with SMTP id d9443c01a7336-206b61824c9mr14802495ad.37.1725439256381; Wed, 04 Sep 2024 01:40:56 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.242]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-206ae95a51csm9414045ad.117.2024.09.04.01.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 01:40:56 -0700 (PDT) From: Qi Zheng <zhengqi.arch@bytedance.com> To: david@redhat.com, hughd@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, akpm@linux-foundation.org, rppt@kernel.org, vishal.moola@gmail.com, peterx@redhat.com, ryan.roberts@arm.com, christophe.leroy2@cs-soprasteria.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Qi Zheng <zhengqi.arch@bytedance.com> Subject: [PATCH v3 02/14] arm: adjust_pte() use pte_offset_map_rw_nolock() Date: Wed, 4 Sep 2024 16:40:10 +0800 Message-Id: <20240904084022.32728-3-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20240904084022.32728-1-zhengqi.arch@bytedance.com> References: <20240904084022.32728-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B5F9540008 X-Stat-Signature: oq1f4guhmcgq3rzs9zpzq3amw8qprsf3 X-HE-Tag: 1725439257-479011 X-HE-Meta: U2FsdGVkX18ZkgYx6HYxL8XV0rXAG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uEp6yO/DkbJtkSy/N/MGN4genqINbYrV6tNe16U9ZxnCXFKrU/py9kJFaO8yyWHJ/JALpoaeDy2tlbIMBvEUaO5VVlEeswHjOi6NBrLaFePtD1s8+qcROJ9RG+kyBtcQFi9klkg1JiZI1g5vGkBRWWXClrtIN3qTgy7aXvoVu+p8d1Gf77P/ZUxUQh8lFUP20FTt86fqpn2HU8V5m8s90/KiIKfND3WDkqP00o16vlQ0qk4h4y95Jwi0bo0jropxtm1Wvqngi5u+xs9vRnn3U+T5I65jW4ys09fiRaD0OtfAHiEWZpgCYpAAEMpL6pGB9OZmEwJ7cGOflWPs8A= 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> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
introduce pte_offset_map_{ro|rw}_nolock()
|
expand
|
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index 831793cd6ff94..de6c7d8a2ddfc 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c @@ -94,6 +94,7 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address, pud_t *pud; pmd_t *pmd; pte_t *pte; + pmd_t pmdval; int ret; pgd = pgd_offset(vma->vm_mm, address); @@ -112,16 +113,22 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address, if (pmd_none_or_clear_bad(pmd)) return 0; +again: /* * This is called while another page table is mapped, so we * must use the nested version. This also means we need to * open-code the spin-locking. */ - pte = pte_offset_map_nolock(vma->vm_mm, pmd, address, &ptl); + pte = pte_offset_map_rw_nolock(vma->vm_mm, pmd, address, &pmdval, &ptl); if (!pte) return 0; do_pte_lock(ptl); + if (unlikely(!pmd_same(pmdval, pmdp_get_lockless(pmd)))) { + do_pte_unlock(ptl); + pte_unmap(pte); + goto again; + } ret = do_adjust_pte(vma, address, pfn, pte);