From nobody Tue Dec 2 03:00:12 2025 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83EA034BA5B for ; Mon, 17 Nov 2025 22:47:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763419639; cv=none; b=jbBuOpgidhqv/FDwI0StLxHNfEynjueMGi7QQ11vhzTJedfvivAxzDKHq3tOZ+wUpo3jcndTkdhONNhgDG35tQGMrBNyklyLYBGyMsrlPBdYpIF66SrN04Q+q8ZRbKfoDsy/AGdmEkm7tljduT+4LMh4whiMV5Vid6EMqskABP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763419639; c=relaxed/simple; bh=tfIrZCoJ3VIjC7+RLHtxfRRKbaNTL7uBfbInHHXOwE8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fVPIzBQaCJbd3f8a3OQ9BKYoxyHFVk/ccD4n5sasn5S3EWeeVDaSGWALocpK2/eum3RzvVwYiQH2cKZ2sfOYAntahLod1s50QM4FegSmnvFpcqVItLq8OaZdt1yUmlAoIOGmQRBVx3W19pQc2w2iaSyHndTxizbEJ493o3cjLU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ackerleytng.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=g7BTvmZO; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ackerleytng.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g7BTvmZO" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-7b6b194cf71so6335761b3a.3 for ; Mon, 17 Nov 2025 14:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763419637; x=1764024437; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZYrCejxRy7zqyBcb6FQMxX806Q+d7GZ40YGLARpuYbw=; b=g7BTvmZOI/LSZ+tuNi5YY1JLkZMh4ONfi18XrXYPP7djTk7BsfWZbQ05hBzn4+9EGa /RfRUQQmgi4BE+ZMkTSGzG07Q3EfqCejwn67KWf+aPXw3Ivj7ehMFFv1r3oTXDVPkCRn A7NbbJvnE5sp4LG2cEqtVC9eoG30CUh9orn1313aINsUKPwwwO0IXbb2ru7enpGaGd9h 9quVpRSRd/uTGDSvVaCck51sWWVqNFY40MmsTqbec5uUf2mrMWCfdXEpSzBaYwvk30D4 K1szaxXI2ps1mWvOm7Qgfme+7L4jIFTpUIwVps6NMvGlkuYm3pCOXeg5HR1uaYtmf31z iCSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763419637; x=1764024437; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZYrCejxRy7zqyBcb6FQMxX806Q+d7GZ40YGLARpuYbw=; b=XcY+GcBUHyTbbsH5B7n4KawBnO0jnNUf/QmvYvvuuImWItoKxtynAYJmSX9qQLT4rk EVUzXfitG0p8ktTkuRuy7PiIAblmkwzLmmBSq6jWNl99dSK/Ux5sBYL3sueiDU8CNYBO sBnHjwGNwY1F/iNXCowsOpBOovWTUxXj92sCs8T0ZbhPZSx0tB+wEHBDB/69YiLTyiM8 TGEgqnTWeymgnMNIq1VgDDfHaoKMjO+Al4u8qX3T4NoFaIroPosg0xnSzfXv6ZeN306R Wo7QI5mxOaM6W53w/bm+t5p3YrLLCYakBHGfYAJXrfg0XY5rsdvgmajqFlV2OEFKUVRP Pd5Q== X-Forwarded-Encrypted: i=1; AJvYcCV+zf4H3IcrnnH68zubCfqFnDjrIUPBAjBx/qrmf41MnJgEBNNgsiRtv+2IOOuoNqa8wzMl4MnzyMOXdCE=@vger.kernel.org X-Gm-Message-State: AOJu0YzaW0i/lU7yzkCM9hb3xSC9+JMZZuC7oTt9DN8Bcbwwa7bjrxh4 v8Pp9csaftRkgTnQPWMK+SOdsztiRxgoZ4ohU72VoLECTMEP7kABJL4vLW/o9Vu4hvo0/lvt6yP qkGzHz6Ao7LNpswBmFhEPZF3/OA== X-Google-Smtp-Source: AGHT+IF6X8M1O0ViseXJqknBCFgh9mD5b/95Oi6jmON/74K3wmmst3PfgAJtVAD5wgeUf0evNnb0s3MpsbBQZ/irZw== X-Received: from pgbfe13.prod.google.com ([2002:a05:6a02:288d:b0:bc8:cea8:200a]) (user=ackerleytng job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:33a1:b0:344:8ef7:7a03 with SMTP id adf61e73a8af0-35ba2992e6dmr19087812637.56.1763419636821; Mon, 17 Nov 2025 14:47:16 -0800 (PST) Date: Mon, 17 Nov 2025 14:46:58 -0800 In-Reply-To: <20251117224701.1279139-1-ackerleytng@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251117224701.1279139-1-ackerleytng@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251117224701.1279139-2-ackerleytng@google.com> Subject: [RFC PATCH 1/4] XArray: Initialize nodes while splitting instead of while allocating From: Ackerley Tng To: willy@infradead.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: david@redhat.com, michael.roth@amd.com, vannapurve@google.com, Ackerley Tng Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, newly allocated nodes in xas_split_alloc are initialized immediately upon allocation. This occurs before the node's specific role, shift, and offset within the splitting hierarchy are determined. Move the call to __xas_init_node_for_split() from xas_split_alloc() to xas_split(). This removes any dependence on "entry" during node allocation, in preparation for extending xa_split* functions to support multi-level splits, where intermediate nodes need not have their slots initialized. Signed-off-by: Ackerley Tng --- After moving the call to __xas_init_node_for_split() from xas_split_alloc() to xas_split(), void *entry is unused and no longer needs to be passed to xas_split_alloc(). I would like to get feedback on moving initialization into xas_split() before making a full refactoring to remove void *entry as a parameter to xas_split_alloc(). lib/xarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/xarray.c b/lib/xarray.c index edb877c2d51c..636edcf014f1 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -1060,7 +1060,6 @@ void xas_split_alloc(struct xa_state *xas, void *entr= y, unsigned int order, if (!node) goto nomem; - __xas_init_node_for_split(xas, node, entry); RCU_INIT_POINTER(node->parent, xas->xa_alloc); xas->xa_alloc =3D node; } while (sibs-- > 0); @@ -1103,6 +1102,7 @@ void xas_split(struct xa_state *xas, void *entry, uns= igned int order) struct xa_node *child =3D xas->xa_alloc; xas->xa_alloc =3D rcu_dereference_raw(child->parent); + __xas_init_node_for_split(xas, child, entry); child->shift =3D node->shift - XA_CHUNK_SHIFT; child->offset =3D offset; child->count =3D XA_CHUNK_SIZE; -- 2.52.0.rc1.455.g30608eb744-goog