Message ID | e920b08e92471a5a3601cc463a3cf6a1254353e0.1724226076.git.zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69679C52D6F for <linux-arm-kernel@archiver.kernel.org>; Wed, 21 Aug 2024 08:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AWBymtmrK19rfh+o6mKAIf3qo5pwJHde1CNDuWd4778=; b=LlXee6enATwm4IkBSgKa19mWTx 4lfkXH0OB42Z2RTJpv9x4GD497nQxALo8wXHT/7DUyphhZLBITZNljkDAjVhu6F7Zw0Yc+RCH/Tc1 sqHlLXIAxgPmJ6ZPUATtAQsKRg14uNV8FzLJslUEN/I6J/LajHeTV9gU3tkjZD32Q8RkjJ2QZSkFJ Wm6mBeXylQoFbkhwZrtGWQYengq/xGSt8Sv/xPmRBt9A7khFaQL5GOEp3cU3ZR4I5V4+8BPr27kkZ ILUT2U9Nawnez6ZmIAsDWpM+R8mDQu22b7ONP6M4FR2NMWZbtrQ+2tuNHK00qU3MM5VjYY5ZBcTPi 1Um17yDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sggdH-000000082wV-0dN6; Wed, 21 Aug 2024 08:23:55 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sggZV-000000081u0-0q56 for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 08:20:03 +0000 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-2d3ec4bacc5so377357a91.1 for <linux-arm-kernel@lists.infradead.org>; Wed, 21 Aug 2024 01:20:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1724228400; x=1724833200; darn=lists.infradead.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=AWBymtmrK19rfh+o6mKAIf3qo5pwJHde1CNDuWd4778=; b=WaCDmtKugcQMV42UCoGRIU5U631Zfg1JLiBnpNY2ygHNcUByEC5f6EevamZVtyh5Mv AalUinlzfQhIptIN2P6UlaEf+AMHoFCq1dvVN8bju8NrmK0KO0ScPITQbTf6W/Tcf6L2 eKiJeLiV0I5OxxibuB5m0DhZvu+JMr4vpGwdPwJirqa3NuT/wajL0qPf6Tt9mp6Cl/LC 7maqboLoWQHKhV7OD0LiYRKhdf+YBAEFq9GHHqDNrtrVOMcgtqdlqKf2dabTj/kUqW/p KqAMJZDutcMfMtKh4zWSE543TahF5sjD1BESKMtXr5TbqGafCaCix9lu58HE3FIDXCJb D7cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724228400; x=1724833200; 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=AWBymtmrK19rfh+o6mKAIf3qo5pwJHde1CNDuWd4778=; b=SG1RL1pmYcpPoFQ0QsYO3Q02w86hEqrvs61egIczO4LpatrM/yotoqPF1cOWHQLNfp 81DlopGxy6p9QrhRGOSzHSlercLsK/MXSsz3tQ1o9vxV5KqmfgaUB0kr2PF1lhy84tW5 EOTI48xJAzs4dxcw7l7QYYrAqUQUg/7RYqkTRPINFoXrbj82QgJd3DDknjDc4GkPk613 hZdYcF4VJLPeyG7zvFTs/LacphmVA9fkh8+Wdvop9Bq7wItihUu45P0D33tyg3Y1ynoU cqRsXate9DSIiHr3n/7pEe6y5O8OFvdfkw+FCH3O3fy3DbMzrWQEHNqm04rHt9XjnJzO N7Uw== X-Forwarded-Encrypted: i=1; AJvYcCUu6us902GjbiZlIAWJS7YKBfxwqoJyJ5TNMUpN9EvoWOZ59vFpXcbOQyj6bwscyfDexhFU82Y2S/k4IZxf7qak@lists.infradead.org X-Gm-Message-State: AOJu0Yyg1OBMDkEYLZSoTwZSZ0uCdIa6xjH2TvTPI5zioqcGs5t5Stck VQJeWn+NszsmkugbQSYNyGk4H4FZsv0Jn6e4ONdUJ5+6S5fa3hHAbThIJebQ9Rw= X-Google-Smtp-Source: AGHT+IETLNjbMtdResL0gCQrMShCwCpeGL/L1zL6e1zJRM+ER4woSJMvk4wtR2Cz+Z4m4+aIJL98tA== X-Received: by 2002:a17:90b:4c8d:b0:2cb:50b8:e59d with SMTP id 98e67ed59e1d1-2d5e99a5e05mr2805975a91.12.1724228400217; Wed, 21 Aug 2024 01:20:00 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.150]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d5eb9049b0sm1091453a91.17.2024.08.21.01.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 01:19:59 -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 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 05/14] mm: khugepaged: __collapse_huge_page_swapin() use pte_offset_map_readonly_nolock() Date: Wed, 21 Aug 2024 16:18:48 +0800 Message-Id: <e920b08e92471a5a3601cc463a3cf6a1254353e0.1724226076.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <cover.1724226076.git.zhengqi.arch@bytedance.com> References: <cover.1724226076.git.zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_012001_252650_7A87F54A X-CRM114-Status: GOOD ( 12.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
introduce pte_offset_map_{readonly|maywrite}_nolock()
|
expand
|
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index cdd1d8655a76b..26c083c59f03f 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1009,7 +1009,11 @@ static int __collapse_huge_page_swapin(struct mm_struct *mm, }; if (!pte++) { - pte = pte_offset_map_nolock(mm, pmd, address, &ptl); + /* + * Here the ptl is only used to check pte_same() in + * do_swap_page(), so readonly version is enough. + */ + pte = pte_offset_map_readonly_nolock(mm, pmd, address, &ptl); if (!pte) { mmap_read_unlock(mm); result = SCAN_PMD_NULL;
In __collapse_huge_page_swapin(), we just use the ptl for pte_same() check in do_swap_page(). In other places, we directly use pte_offset_map_lock(), so convert it to using pte_offset_map_readonly_nolock(). Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- mm/khugepaged.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)