Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1101969lqb; Wed, 17 Apr 2024 23:16:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQpEF483tLU4EUzGmFC6E2alT4Hj6r81VEDuPVWzJ2mloTdzGXAt2Fve0rxcJkExJBpFN6E6Ey859iuuxd2piljL/WaYWrTMqtvMoKrQ== X-Google-Smtp-Source: AGHT+IHXMxTaSLlqK14OSpiAnASO5uSt+7E58dEuplmNiv4thCeIDDiNNNsQHpJI3wI1QgEQdlEP X-Received: by 2002:a50:d598:0:b0:56c:4db:33f7 with SMTP id v24-20020a50d598000000b0056c04db33f7mr1486947edi.10.1713420972181; Wed, 17 Apr 2024 23:16:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713420972; cv=pass; d=google.com; s=arc-20160816; b=JSjoPFpcPjuLxmhr7nNAUbk+WHpruQ9XPpaUK4lNiqc+SZL7mQ+tjkXFeu8UVXFbMw hMmpOPOv9Kn/JHA3BT+WBNc3h5j60ZeELBMUIIhEFwaqzDuu21DXWiReminnTWGRUo8f wW6Ry+1WNyd+rFMJ99V9p+9g6oWe1T09iSIJdYydAaCC5cqYfn2UZ80BJx81IC070MGv 5zd3OqJkuuDeSjQ4VHYE856zQALfJwQeSHnbFgz5A0s4XEZL4tbE8TWDcvCskrOa4zcH WIp8Ci1kP2I8LTLjR3fcjI/eP63TETlH5PaebVeU686h8UdD+aDNIuGrsoMM2Nxj2Yfj z+3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from; bh=DXRIJdBTI4JMeLiUqF/DwOHmi4232WnymtijAP7MU4U=; fh=ZH+M10KtJZRqSjFjp1+uAYTvsWtGX6qxh/YkifVvH1o=; b=cmfWXiyXe3QWMqBMcu7uxWnuppLDjgE75TmBd3PHvdsjzZfsSKxj2Fcv7/56C7AKpg iPOTS8oxumHhLl43WL7PpIRsxdTde98Mp9Kzqs4J41O1xpIxK37ONVQt4IZlBj3syHfB Cp+oA5EkPLlygQylehimPUK7FU7ZUNl0IIF2NSm3UHrcRVAab/y7siJB8W8Hc2KmTBlE RWHS48YMJq9tU13hw1H3pbcp1IXzYY2DKrQdk3EGfRydBizHhFmrVBCP+g8Gu/B2ALFX OulCurBk2umjlrgfKA0cYlxU3+S0kzCF0P2hEbxOVtyRPhTKlsH/FxUwU71ZTWXOr3KT G6OQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-149559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149559-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m16-20020a509310000000b005705b381c71si491184eda.395.2024.04.17.23.16.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 23:16:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-149559-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149559-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E00931F21963 for ; Thu, 18 Apr 2024 06:16:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC0CF73199; Thu, 18 Apr 2024 06:15:54 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 761B44EB32 for ; Thu, 18 Apr 2024 06:15:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713420954; cv=none; b=hZgFtjHEQebwDv5N1HiAodqHTdMZVfwET7uFR3rGdFC0QNvlQ74b6ABS4aVK2dfLOaMAQDreZ1cJm2u37AgSE29yQbt+DJTUpwUSTYCX4wngV1L0nTpVY3VpxX6B57sNpEqnIuP1g14Jjj8peHqsU+fMZbnNFKuFiH+Q++32THQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713420954; c=relaxed/simple; bh=2MKSxAJ2mBZDz9V39JhFe+05XOOJBWLN/9CInRv7UqI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=mMqm/x5ZrVT0Ib0izvBE/xauTtswiTSi53rlOGrT3tGG+m3GLH5FzJryCI5JdSj4EXQPfVxOrqa3qAbe6eFbY+BSM2L70SYJ9kVNLz2W2kZQVAbz4TTnsaxdnWknwuyFWW/fks75Hb8psHrlWaNjhsguul0OSa9VE86oMvU62RA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d6dff70000001748-fd-6620ba924102 From: Byungchul Park To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: kernel_team@skhynix.com, akpm@linux-foundation.org, ying.huang@intel.com, vernhao@tencent.com, mgorman@techsingularity.net, hughd@google.com, willy@infradead.org, david@redhat.com, peterz@infradead.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, rjgolo@gmail.com Subject: [PATCH v9 rebase on mm-unstable 1/8] x86/tlb: add APIs manipulating tlb batch's arch data Date: Thu, 18 Apr 2024 15:15:29 +0900 Message-Id: <20240418061536.11645-2-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240418061536.11645-1-byungchul@sk.com> References: <20240418061536.11645-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsXC9ZZnke6kXQppBi2zjS3mrF/DZvF5wz82 ixcb2hktvq7/xWzx9FMfi8XlXXPYLO6t+c9qcX7XWlaLHUv3MVlcOrCAyeJ47wEmi/n3PrNZ bN40ldni+JSpjBa/fwAVn5w1mcVBwON7ax+Lx85Zd9k9Fmwq9di8Qstj8Z6XTB6bVnWyeWz6 NInd4925c+weJ2b8ZvGYdzLQ4/2+q2weW3/ZeTROvcbm8XmTXABfFJdNSmpOZllqkb5dAldG w70XLAVr+Cp6P81naWCcydPFyMEhIWAisXuxShcjJ5h5/FETE4jNJqAucePGT2YQW0TATOJg 6x92EJtZ4C6TxIF+NhBbWCBJ4uP+GWA2i4CqxKOHXawgNq+AqcTSnd2MEDPlJVZvOAA2hxNo Tv/7Q4wga4WAai78Deli5AIqec8m8epUKxNEvaTEwRU3WCYw8i5gZFjFKJSZV5abmJljopdR mZdZoZecn7uJERj2y2r/RO9g/HQh+BCjAAejEg/vyQPyaUKsiWXFlbmHGCU4mJVEeFuEZdOE eFMSK6tSi/Lji0pzUosPMUpzsCiJ8xp9K08REkhPLEnNTk0tSC2CyTJxcEo1MFqb/PT/tpbn 3aTwWxt1nfR13k+2FJSUv/im4+WhY5eUFp0UeMYVnOjg/c65nn+i+umv/J+37n/x483RF/oX P/0UCVWV/vcurv68zwnzqoJ35pKhjmIJ85Xk9KOc9X5u8ZSZxa1/w+jU2VeJnQpXThvee3BF k1vpCeOxNSdDGKIKE9y1tbeqiSqxFGckGmoxFxUnAgDQigswdwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsXC5WfdrDtpl0KawZRfGhZz1q9hs/i84R+b xYsN7YwWX9f/YrZ4+qmPxeLw3JOsFpd3zWGzuLfmP6vF+V1rWS12LN3HZHHpwAImi+O9B5gs 5t/7zGaxedNUZovjU6YyWvz+AVR8ctZkFgdBj++tfSweO2fdZfdYsKnUY/MKLY/Fe14yeWxa 1cnmsenTJHaPd+fOsXucmPGbxWPeyUCP9/uusnksfvGByWPrLzuPxqnX2Dw+b5IL4I/isklJ zcksSy3St0vgymi494KlYA1fRe+n+SwNjDN5uhg5OSQETCSOP2piArHZBNQlbtz4yQxiiwiY SRxs/cMOYjML3GWSONDPBmILCyRJfNw/A8xmEVCVePSwixXE5hUwlVi6s5sRYqa8xOoNB8Dm cALN6X9/CCjOwSEEVHPhb8gERq4FjAyrGEUy88pyEzNzTPWKszMq8zIr9JLzczcxAsN4We2f iTsYv1x2P8QowMGoxMN74oB8mhBrYllxZe4hRgkOZiUR3hZh2TQh3pTEyqrUovz4otKc1OJD jNIcLErivF7hqQlCAumJJanZqakFqUUwWSYOTqkGxoVt8vsezf/IU1n9/PvbOR9t2n9fmGn/ TD+yb6VQSPA1wyWcZp5SnRtL3z1YE5jHp7yUY4eehY6k6N7XebFz9/F9OzFrqb+kGHf1u4Wn Gv2yfjdqyk38tXg9u8QrEfaNVxwZi8J8pj53dm5NmpTDcVF9/r7KW5On+/TtPuLJKPxhy9uq 3GdP9ZRYijMSDbWYi4oTARgcRMNfAgAA X-CFilter-Loop: Reflected Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This is a preparation for migrc mechanism that needs to recognize read-only tlb entries during migration by separating tlb batch arch data into two, one is for read-only entries and the other is for writable ones, and merging those two when needed. Migrc also needs to optimize tlb shootdown by skipping CPUs that have already performed tlb flush needed for a while. To support it, added APIs manipulating arch data for x86. Signed-off-by: Byungchul Park --- arch/x86/include/asm/tlbflush.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 25726893c6f4..a14f77c5cdde 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -293,6 +294,23 @@ static inline void arch_flush_tlb_batched_pending(struct mm_struct *mm) extern void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch); +static inline void arch_tlbbatch_clear(struct arch_tlbflush_unmap_batch *batch) +{ + cpumask_clear(&batch->cpumask); +} + +static inline void arch_tlbbatch_fold(struct arch_tlbflush_unmap_batch *bdst, + struct arch_tlbflush_unmap_batch *bsrc) +{ + cpumask_or(&bdst->cpumask, &bdst->cpumask, &bsrc->cpumask); +} + +static inline bool arch_tlbbatch_done(struct arch_tlbflush_unmap_batch *bdst, + struct arch_tlbflush_unmap_batch *bsrc) +{ + return !cpumask_andnot(&bdst->cpumask, &bdst->cpumask, &bsrc->cpumask); +} + static inline bool pte_flags_need_flush(unsigned long oldflags, unsigned long newflags, bool ignore_access) -- 2.17.1