From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 30371C433EF for ; Tue, 23 Nov 2021 09:38:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 957496B0071; Tue, 23 Nov 2021 04:38:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 907516B0072; Tue, 23 Nov 2021 04:38:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81E726B0073; Tue, 23 Nov 2021 04:38:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id 74BD56B0071 for ; Tue, 23 Nov 2021 04:38:32 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3FFE28CE34 for ; Tue, 23 Nov 2021 09:38:22 +0000 (UTC) X-FDA: 78839694444.04.E507B6E Received: from gentwo.de (gentwo.de [161.97.139.209]) by imf03.hostedemail.com (Postfix) with ESMTP id 94BA330019C3 for ; Tue, 23 Nov 2021 09:38:18 +0000 (UTC) Received: by gentwo.de (Postfix, from userid 1001) id 4E87FB00470; Tue, 23 Nov 2021 10:38:19 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by gentwo.de (Postfix) with ESMTP id 4B2D4B0035C; Tue, 23 Nov 2021 10:38:19 +0100 (CET) Date: Tue, 23 Nov 2021 10:38:19 +0100 (CET) From: Christoph Lameter X-X-Sender: cl@gentwo.de To: Wonhyuk Yang cc: linux-mm@kvack.org, Joonsoo Kim Subject: Re: [Question] The necessity of transaction ID in SLUB. In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 94BA330019C3 X-Stat-Signature: tfnoief8sgd8obmbe6h86c1hifhq6u1g Authentication-Results: imf03.hostedemail.com; dkim=none; spf=none (imf03.hostedemail.com: domain of cl@gentwo.org has no SPF policy when checking 161.97.139.209) smtp.mailfrom=cl@gentwo.org; dmarc=none X-HE-Tag: 1637660298-914025 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: On Tue, 23 Nov 2021, Wonhyuk Yang wrote: > Do you mean that without TID, multiple cpu can race on one > cpu_slab->freelist? > > How is it possible? As you know, cpu_slab is per-cpu variable and > cpu_slab->freelist is accessed via "this_cpu_cmpxchg" in the area > where preemption is enabled. That is the problem. Preemption is enabled. This means that slab_alloc can be preempted at any time and continue to run on an arbitrary other processor and also continue at an arbitrary time. It may also be rescheduled on the processor it ran before after executing just one instruction or so on another processor. Yes another thread may therefore also start to execute slab_alloc() on the same cpu, get the same per cpu pointer and perform some ops. Somewhere in the middle of this another processor may continue the first thread that was preempted earlier.