Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp398970rdb; Mon, 15 Jan 2024 00:20:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeoUGCUaYcvUwyc7B9lkLdQY7IgvbnOlDZOIHjhC8H59cEqorAlrTuKeuVA70PwK9+R2TH X-Received: by 2002:a17:902:f542:b0:1d4:9d07:eb13 with SMTP id h2-20020a170902f54200b001d49d07eb13mr5946306plf.99.1705306824651; Mon, 15 Jan 2024 00:20:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705306824; cv=none; d=google.com; s=arc-20160816; b=QaUsH9o39/GQlxWaGskSwsfI1y9pGBtmz4/v4sOIYGY2Hw5rhFJ13ICtbWINMXUS5t 7VSQ+/O+5pNCZhxFc/ciOoX7slIjAwPD2gFn2sr7lCCghPQxy3CUpnbIINNbPtgPqPyZ jCCfESI1cBMRQ9ePitFOdNWhSq/RD4iHfQN2vjtShf9jyiwvcLh799JfYZ4gSOaQDQdM qx4vLOt9InEbGGreDnL3/Q7HAds937mks486mKivHFQbmMDdJWtrBcBUsUc2UVTz/1c4 cIQX+pnEiLOMtgBh4+kgt7r9LVDsc6ZardQzJRw78Pb1ZpUweSXL3arLqYgiJU95tU6h StCw== ARC-Message-Signature: i=1; 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=eRD1/8o+qtEOTAKMY7ucioDJJtMI3+WpTL+ASvHX4To=; fh=I/fJb8ryqmmGEnsMy9AhDuMN2ego/v5YAM2Gbv30rAg=; b=WAwZlUwGggEObzYE5J0n0aIdVrMKOniiqrTbFM6GSl7awLg71eCKVJef+/fc4xa7Ir I1hMCpsNygVdFfavrLT7bmpOsaJNQFX2jsWQrYRBKUOO6kOxTTQ3HPDkUalWMOyVD2ga MLX7SgLVPoL8uxpflwhGwQ1BbIk/EO2mHJoXFgageqNTlZnryy19vOarqwT/2JPp1bwo mA4wMf0D2C2w4I1Ryl10xc93HnHvA8Lfbjxm1J8UMxZVabCRgDwOY8QVjMS/QhZ05C1G 4Map3F/bAh+rTfN84pgPssHkKxIo2GE496s+Zjyh8MNByA2sHkyTWwXt5v7dx/9/aANy 3usA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25714-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id jy15-20020a17090342cf00b001d449bf1819si8242455plb.108.2024.01.15.00.20.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 00:20:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25714-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1BBDFB20CFF for ; Mon, 15 Jan 2024 08:20:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 373A763DA; Mon, 15 Jan 2024 08:20:10 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66A775CA1 for ; Mon, 15 Jan 2024 08:20:05 +0000 (UTC) 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-d85ff70000001748-75-65a4eab4da69 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, namit@vmware.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 v6 1/7] x86/tlb: Add APIs manipulating tlb batch's arch data Date: Mon, 15 Jan 2024 17:19:47 +0900 Message-Id: <20240115081953.2521-2-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240115081953.2521-1-byungchul@sk.com> References: <20240115081953.2521-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrALMWRmVeSWpSXmKPExsXC9ZZnoe6WV0tSDXZN5LGYs34Nm8XnDf/Y LF5saGe0+Lr+F7PF0099LBaXd81hs7i35j+rxflda1ktdizdx2Rx6cACJovrux4yWhzvPcBk Mf/eZzaLzZumMlscnzKV0eL3D6COk7MmszgIenxv7WPx2DnrLrvHgk2lHptXaHks3vOSyWPT qk42j02fJrF7vDt3jt3jxIzfLB7zTgZ6vN93lc1j6y87j8ap19g8Pm+S83g3/y1bAH8Ul01K ak5mWWqRvl0CV8bt2y+ZClbxVSz50c7WwDiNp4uRg0NCwERiU4NxFyMnmLns9nJGEJtNQF3i xo2fzCC2iICZxMHWP+xdjFwczAIfmSRWf+9gAUkIC/hIvG16CVbEIqAq8fvGSTYQmxdo0Jxr DSwQQ+UlVm84AFbDKWAq8e7jcXYQWwiopuXuOlaQoRIC7ewST1adYodokJQ4uOIGywRG3gWM DKsYhTLzynITM3NM9DIq8zIr9J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 4vq65n7Nhgdfoict2ypnmriMt+8y9+NrTLv6N34rW26r5bxvadM6F/l1K/N3b+C5+Pr6GsmT jyZ/Y51lsswy8s37qunmGq51bvFKLMUZiYZazEXFiQBY1mM4awIAAA== 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 batched TLB flush by separating tlb batch's 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 CPUs to flush by clearing ones that have already performed TLB flush needed. 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..fa7e16dbeb44 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