From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sg-1-104.ptr.blmpb.com (sg-1-104.ptr.blmpb.com [118.26.132.104]) (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 15DEF217722 for ; Tue, 13 Jan 2026 06:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=118.26.132.104 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768286538; cv=none; b=gNn1XC8Rvf2bDuOQ4C6yyFc6rZdds+yyb/X1uDGFiuZAV3YqtzjsdgNYHK5M2D/N1TiLpvgUsYmWlK4g8L4cJ4U0ru/41Bu5KORpKk8EOKID5k1dHy+TR4yZfQ5EYpmGsGqnjd86kIXbMS8OCSI+4qETTQYKaqjY9pYULQ7HM6c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768286538; c=relaxed/simple; bh=uMcSo0D2Ug0vZz3p/5XqLG0MIP9qURBjlbdel3o9Dk4=; h=From:Subject:Message-Id:To:Mime-Version:In-Reply-To:References:Cc: Date:Content-Type; b=cE86+AcuOK4x0gqffM7AmRyUjROHGxJ5oKyV3AFZzkItQPVUFaP5p2yixTNicppGsMg3QzJnPsZ2vnDtk/jF/9lSPcEYTiI49gOFDX2WjYHdc2c0U6wo3E+HCXzwLg1ZFqyOeplEswqENGxH9XGAewELF/Tbl76A4Jt/20UiBeY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=YcyW8Nml; arc=none smtp.client-ip=118.26.132.104 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="YcyW8Nml" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1768286530; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=2Qb1R4lnjaFXVEvzdYsxnVqS8DmE3lYGKOt4usy55kw=; b=YcyW8NmlcrOM6tM/LguKMMJyP/+8swEA9nPSC12emQH5xPOQifiP3wZsrTpkwIriIQ7mXt zDTq2Qburr4aJv99EvyttjBh+sRPe56EHBKLrMizl3idFkpGsac7hl6xXf035ZpKdJUCE1 X7fbftjhticwWCB+ylwAXWF0TYbWEPh8IF79D26pwPfDgxcSL79zege9AUQ/QRhgAxUlSr cXkec3gV849VnhaD6NmNrqZ23YONy3DKsnM6+oZF3fkOgLOYmB6UEMaAIYulWorpWVzPWx Opp1PiIfNW1e/X1ICMo87MYwinyu1FxoQtxjKAXNo2dk5Fph/q7PWjv17hbK6w== X-Mailer: git-send-email 2.45.2 From: "Li Zhe" Subject: Re: [PATCH v2 0/8] Introduce a huge-page pre-zeroing mechanism Message-Id: <20260113064155.29900-1-lizhe.67@bytedance.com> X-Original-From: Li Zhe To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 In-Reply-To: <87jyxmjxs6.fsf@oracle.com> Content-Transfer-Encoding: quoted-printable References: <87jyxmjxs6.fsf@oracle.com> Cc: , , , , , , , Date: Tue, 13 Jan 2026 14:41:54 +0800 Content-Type: text/plain; charset=UTF-8 X-Lms-Return-Path: On Mon, 12 Jan 2026 14:01:29 -0800, ankur.a.arora@oracle.com wrote: > > In user space, we can use system calls such as epoll and write to zero > > huge folios as they become available, and sleep when none are ready. Th= e > > following pseudocode illustrates this approach. The pseudocode spawns > > eight threads (each running thread_fun()) that wait for huge pages on > > node 0 to become eligible for zeroing; whenever such pages are availabl= e, > > the threads clear them in parallel. > > > > static void thread_fun(void) > > { > > epoll_create(); > > epoll_ctl(); > > while (1) { > > val =3D read("/sys/devices/system/node/node0/hugepages/hugepages-10= 48576kB/zeroable_hugepages"); > > if (val > 0) > > system("echo max > /sys/devices/system/node/node0/hugepages/hugepa= ges-1048576kB/zeroable_hugepages"); > > epoll_wait(); > > } > > } >=20 > Given that zeroable_hugepages is per node, anybody who writes to > it would need to know how much the aggregate demand would be. >=20 > Seems to me that the only value that might make sense would be "max". > And at that point this approach seems a little bit like init_on_free. Yes, writing =E2=80=9Cmax=E2=80=9D suffices for the vast majority of worklo= ads. However, once multiple mutually independent application processes each need huge pages, the ability to specify an exact value becomes essential, because the CPU time each process spends on zeroing can then be charged to its own cgroup. If we currently considers =E2=80=9Cmax= =E2=80=9D sufficient, we can implement support for that parameter alone and extend it later when necessary. Although =E2=80=9Cmax=E2=80=9D resembles init_on_free at first glance, it l= eaves the decision of =E2=80=9Cwhen and on which CPU to zero=E2=80=9D entirely to use= r space, thereby eliminating the concern previously raised. Thanks, Zhe