Message ID | 7e9c194a5efacc9609cfd31abb9c7df88b53b530.1727332572.git.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 52AD8CCFA07 for <linux-mm@archiver.kernel.org>; Thu, 26 Sep 2024 06:48:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D63E26B00B7; Thu, 26 Sep 2024 02:48:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D13586B00B8; Thu, 26 Sep 2024 02:48:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB40C6B00BA; Thu, 26 Sep 2024 02:48:22 -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 9B4356B00B7 for <linux-mm@kvack.org>; Thu, 26 Sep 2024 02:48:22 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5B2F41C6B9E for <linux-mm@kvack.org>; Thu, 26 Sep 2024 06:48:22 +0000 (UTC) X-FDA: 82605960444.29.6E25C14 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by imf04.hostedemail.com (Postfix) with ESMTP id 8AA224000D for <linux-mm@kvack.org>; Thu, 26 Sep 2024 06:48:20 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=PYNhF9Lp; spf=pass (imf04.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.160.176 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=1727333239; 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=wKWf8ZYo9tlbP3964sEqp7HhdDy32FNbDdGL8iSt+Ok=; b=PtZCn/LxEE2ofpEZ8uOCEyoOxEnHh2d3PSy8Rp2RIGsRI8ATGn19BI9jWrmlmnzUrOEmvv L6U3Kp5GuIv2HyT0BejnA4xA1SvKfz82kNQzU8Y6wiNc1fviQkZd+GugTwf1jnrTF1oyWa dxP9favonTnSO1Opp8/ln75taBFZ6wQ= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=PYNhF9Lp; spf=pass (imf04.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727333239; a=rsa-sha256; cv=none; b=ExpZs4RZ09haZ3Gwlvc23kYg/0I4yG4JYT8XiKBkhINWZsW5EeRXmB1cu07tjtfvEreiBd p8rZG2dkGs64h3JGy2yPpVO3wsTOTaqqS497I5HtPRz2kRXLxmhO+HmrGSA2ui6COI6qDq aLUvod3ems1tZxXwiGYnqxjJcfCBOJA= Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-4582fb3822eso4032111cf.1 for <linux-mm@kvack.org>; Wed, 25 Sep 2024 23:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1727333300; x=1727938100; 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=wKWf8ZYo9tlbP3964sEqp7HhdDy32FNbDdGL8iSt+Ok=; b=PYNhF9LpQ/pdM20PBJAVk7fTA1EHXeaYvEi26PBHRDATn954o635Q1AjlwbJZOg7Gu gKDa8VY3EHmuw4In/5oitn9tUqAfxdjEkJ9gKG7qsIC9GPAZ5W4NZT9gWwKVTGRxgoEe PlfUck/C6XEnITq6c6xmIqKOBKSLx3GAVL0SfyMZUYEhdOOHomukKJV41BmGiolc2OzL PWdBlQmr9PgdX4GKkf2U4kCWMXTJOgpRHzZmnurh38GHzXnwx4e4fQ5yRGGVnyJOmIbH 2yhyVhQ2cor8062ajEnQCuxxUH4tg7r1+MWXAyXsNbeb9tMxJcuGg6Fk9LFXwXIDJ69c cegQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727333300; x=1727938100; 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=wKWf8ZYo9tlbP3964sEqp7HhdDy32FNbDdGL8iSt+Ok=; b=Sj88/W4tJ2kzbh2WLS86X4jS0W6QVbBZ7kyegk970yEaMrOt3MelhJlkjKNSYzZLLE jkXRnw499O1E8JqNAChTCUKtXJf0lAxzMkpgQA0R+LltGdH9KjtHgBmiDaqBVDNqeew4 03MriVx9gNgEFkd2fb/zIacDnAS/UX2DYO39+7GrC/MEvNmSIdMBZIwzUcrrGgN6xSAx fp82dineHdY2ERPZjKSDVgosP2h9Q7cnjdsbjcGLK9yYlnTwX+HXNZ7LwK+MYDHlpefI gMJugIWA4scralM2hVhMW3lqYsOmLLV3e7eJzE/dhet9celm5rb5NFFBTOVAAWjhBCk+ 8ECA== X-Forwarded-Encrypted: i=1; AJvYcCXzg1t8V+90XWh+5lALjOsIN+5Ky4EcSrgUpROKQA1faQG0Wh5bIF5D38bA+0pR3+fXynkaUbqwCw==@kvack.org X-Gm-Message-State: AOJu0YzaO+s5a9drFvVEqqpUN2IvY7JxRx0wPRjiH52hS4NF86IKR1+I CjjOOOzK+gufI3kmPDciMJgakNIyox6+IQX2nAYhQZSGurhYp1W4o9uvS28p4sU= X-Google-Smtp-Source: AGHT+IH0PykjARYOlhRdYD8Ei00ntSXkZvlp+w/DvL/wK29HFMzX/PK1qWz6iq3HMQhndU3PBLr5iA== X-Received: by 2002:a05:622a:51:b0:458:3e20:65d3 with SMTP id d75a77b69052e-45b5e06627amr81705351cf.60.1727333299714; Wed, 25 Sep 2024 23:48:19 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.150]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-45b5257ff1esm23024611cf.38.2024.09.25.23.48.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2024 23:48:19 -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 v5 12/13] mm: multi-gen LRU: walk_pte_range() use pte_offset_map_rw_nolock() Date: Thu, 26 Sep 2024 14:46:25 +0800 Message-Id: <7e9c194a5efacc9609cfd31abb9c7df88b53b530.1727332572.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <cover.1727332572.git.zhengqi.arch@bytedance.com> References: <cover.1727332572.git.zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 8AA224000D X-Stat-Signature: 4cu1fkjumaepo6j5hpk7gwhojkm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n8B9+Zwy2brxDS2KXa46WgmAPuNCGHZMyCoSO3onSiSftvIDzp8CGZ8Rtvg0ao0e1RBOnpO9h3/kOtb7AiN54FbpeiP1F7JYBDs96n9QiHdPJGg0jBmb3+selxH4+Fbn9piNSPG2LvIO5oWwsoNZDpGfF2KRgLDuAKWQnpBhI7QosgXihP3ilVpYpHQ6bZQOyMc83EgLnOAyqBj99LqokyWxn+xdxSavBZJB7LywdhTyQUyewpRFKqtoO53WC/v8tA3z99HE2UENa3WGZpYCrAA2uyQXcljrotgf2xgKo3uJG17qzEO4TN5KvRyV3hJJfb9covBTeItJf259wiAQkxW8UyhNsWEo9WrQgnVPPhwL3VX7m9jVU89V4pndoQo6VuZzK5fjnNXAFC54pzOj9AIQnHzA= 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/mm/vmscan.c b/mm/vmscan.c index 749cdc110c745..bdca94e663bc5 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3375,8 +3375,10 @@ static bool walk_pte_range(pmd_t *pmd, unsigned long start, unsigned long end, struct pglist_data *pgdat = lruvec_pgdat(walk->lruvec); DEFINE_MAX_SEQ(walk->lruvec); int old_gen, new_gen = lru_gen_from_seq(max_seq); + pmd_t pmdval; - pte = pte_offset_map_nolock(args->mm, pmd, start & PMD_MASK, &ptl); + pte = pte_offset_map_rw_nolock(args->mm, pmd, start & PMD_MASK, &pmdval, + &ptl); if (!pte) return false; if (!spin_trylock(ptl)) { @@ -3384,6 +3386,11 @@ static bool walk_pte_range(pmd_t *pmd, unsigned long start, unsigned long end, return false; } + if (unlikely(!pmd_same(pmdval, pmdp_get_lockless(pmd)))) { + pte_unmap_unlock(pte, ptl); + return false; + } + arch_enter_lazy_mmu_mode(); restart: for (i = pte_index(start), addr = start; addr != end; i++, addr += PAGE_SIZE) {