Message ID | e920b08e92471a5a3601cc463a3cf6a1254353e0.1724226076.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 955B1C52D7C for <linux-mm@archiver.kernel.org>; Wed, 21 Aug 2024 08:20:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24EA96B00C7; Wed, 21 Aug 2024 04:20:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FED66B00C8; Wed, 21 Aug 2024 04:20:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09F496B00C9; Wed, 21 Aug 2024 04:20:03 -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 D96796B00C7 for <linux-mm@kvack.org>; Wed, 21 Aug 2024 04:20:03 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7C777160AB3 for <linux-mm@kvack.org>; Wed, 21 Aug 2024 08:20:03 +0000 (UTC) X-FDA: 82475554686.18.CE5BFC8 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf13.hostedemail.com (Postfix) with ESMTP id AE4F720002 for <linux-mm@kvack.org>; Wed, 21 Aug 2024 08:20:01 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=JUhqbFn3; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf13.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724228385; a=rsa-sha256; cv=none; b=J7htfW+9MKmZeUeFUAj0trBiof6mp0kFjxrm8Nkgq9mcICgLsOt8FzOfJdeWUZMPhfOb0W CF4ZESCTBh1rsOPIli+NkHXWZXQ3CIyUQob3Jc3tJRx0s5v2PntP9fzrxvQXZpaD/ARcOH 0wZ6Tr8SHPrh1a6Q6cl4QJmNja0MmgU= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=JUhqbFn3; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf13.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724228385; 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=AWBymtmrK19rfh+o6mKAIf3qo5pwJHde1CNDuWd4778=; b=THB0ExtQHmX3hgVz2RICO2csqyysCBbQcLa4JnHrjZnid+8ZKuqGZOhiDtQSbTQs+dyE+b DauFXgX1rcg/jH773fF5S8gjFdMEq4XihinhGvKOk4yT8AqVnr2YzDcGQ2xOrttyVm6Pic cdLetNaglCSS/TbYYIGyMF+HsoNoCn0= Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-7c1324be8easo376312a12.1 for <linux-mm@kvack.org>; Wed, 21 Aug 2024 01:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1724228400; x=1724833200; 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=AWBymtmrK19rfh+o6mKAIf3qo5pwJHde1CNDuWd4778=; b=JUhqbFn3yeP7IrwDsyzskXcZOwlBh0FDgHGsF7v1oghc16P6nKxdOa3Q9yXnvqIJOW tLawfBmu2A9iRdKpjLDYHKV/Hr0fuzh036RIIMyN7tTZUHSG63WCPYHXK0Z5ZQdPCmRZ wO83Lcu4D9OdXqf+q05Wn26DsnTRtuKeecAqgrNvpylo/1hqXI9o5mj3xEQAyEjAE9HP yaAIXAxvvvsL5NqIUXWc3JQrYgoqR2h0jnnFE3RzUZ7wxPbcVGsmCxI57hGDwkbqbemt UydmCwEHrem8FJ1amh7iSTtC9JLqmKmkzuRdvovhgHSniBMgNIO+yTHE37o86qGsQ5p4 UrFg== 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=u2jd+rW+Toqi/euluK4iiyXOanbrxwsh8kr3KC5fzCrQg0pekZnDs47/r10mO6bHto V5wWi3yLCUqo15m7yqbPWjzdwvNuTAFMKlQLVuP5HRwgzgQsi7v4BHCvE8wqH1gV3fNg EdvYauijyMdpmT+c2Pys/q30Fx/tN9LTRSD0YVoy9S88joo5e+F/yVhEJamgts8B/UE/ eYu+RYwgBu+qSKLE83+iitsubKpXn8geihVueNC4r3otCU2K3wngzi9g6HqZP9+DEmpy Id3Ktot3FY9ZwAs5OL6w8WGBCrqtCSLKjocuXzDRxTLLWSO+0VbrXMJxYF91hZlkAalf 8ULw== X-Forwarded-Encrypted: i=1; AJvYcCUd2+Yc4NT8AuyYc5WKQ6bs+erwlrzp5qwHcF3jKOX2zX+fY6d/3zbGtTyJF27ypXFkF25FjOlaTg==@kvack.org X-Gm-Message-State: AOJu0YxmwPWQu41mjNLkyVNiqQvdYzQfuyJ7NDYNC/c4XAiujUeBKlE/ WzyuZGOUR+lYTc/ZSkaxjI8W/YtEfRX3hATQSSOaWfqc88L3kPaO4CU1tQsMu3E= 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-Rspam-User: X-Rspamd-Queue-Id: AE4F720002 X-Rspamd-Server: rspam01 X-Stat-Signature: onozknbitzmyhqi5wdt6ndnuxf9tskam X-HE-Tag: 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sdVf9nYF1PLM9sCwKP+91eEgOOxyh8OOAZr+3a2iz5oeazo5lWhUiCJGD6eIRCuOv48bqPLBtBPt9I5KoziWweL3F2wQNKG0Pc0ixgJEjV7WiyFpX5m8vZ9v0Jzm7scMe86tLU+F+mh0xt0Uq0w3adRWc2/QyKlvzWFhbAFJNk+9xUF8147rlea8qEVH04QjLjTe4Iy/PSlGAmcaftRURNKbGZ8Vgkc9L10ymW63y/zk6fZAM8kLvFEPrzw8FLEml96XMnoeBht9qSgnE8rP4CFZiwtTDBbS8RHHiaxf+sq00b7WggnFEUahsR1lhqFIVsd5ixKL6eGh4xIMSYm2dAWswykywsQxMmKCXBb1yThcTO8FgpZg41Q24FuvGygZv8d X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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_{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(-)