From nobody Tue Dec 2 01:50:42 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84A7E23EA82 for ; Fri, 21 Nov 2025 05:05:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763701515; cv=none; b=KTChg4tMpjlVjx3fuG8NsDUa+WEEZOLK1s0pzxj4bpHQlf1zT3xJHl0jifaXfc/4ECXJUBVgVHLRoxRySSpKQS0ExE+AYI91fZnugaHxClRBbHet8FQsJMlGeOOmA0kE1r52fUEvUA0ERgYQOPlsEK0b9hf0Hbv7fUTgqFSgYic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763701515; c=relaxed/simple; bh=8DdKenlLWv9qvu1kxTPnLGG2p5EnjViE69YPBVIu1LI=; h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Content-Type; b=Fgm8yFwBduiFualk+Ed9Mi+xT2x4bfx18//FtyXJ6HU/KutYvtj17oIwdmKhUTwRA1cd0PU3mWLqaGvTC5jIFPw09v901qAjrSE9Rok9AR9n+a2lie8w1eeLPtCwVw0OJ0btaRnK1/PJMp/c50271k71hq/enA8TajRpmOZr1us= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YLNzfn2P; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=e2DeBbjt; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YLNzfn2P"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="e2DeBbjt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763701511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=bD/kxunI5AdpL1l1WB/VY1TVoSja9N9k7Lo5f+xNMoY=; b=YLNzfn2PfWiUfj9zSf8mKPU6fJ2VQj0cA1EADzeD8DD7CCYrggTqq6Nt58VbkYq+AK9GP0 t71srtHyXUswAmJLF+piKTkUvTlgMNE+Qo3tNIDhpnPAgcC6bM21kVrJoJ8nzBv6+bYQIs CPHU7RbQt/6GbUhfZNWJeZdaQo+l8F8= Received: from mail-yx1-f69.google.com (mail-yx1-f69.google.com [74.125.224.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-pu7wPKOAPTiD6AFXwLhIDg-1; Fri, 21 Nov 2025 00:05:07 -0500 X-MC-Unique: pu7wPKOAPTiD6AFXwLhIDg-1 X-Mimecast-MFC-AGG-ID: pu7wPKOAPTiD6AFXwLhIDg_1763701506 Received: by mail-yx1-f69.google.com with SMTP id 956f58d0204a3-63e2d3351abso1979368d50.3 for ; Thu, 20 Nov 2025 21:05:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763701506; x=1764306306; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=bD/kxunI5AdpL1l1WB/VY1TVoSja9N9k7Lo5f+xNMoY=; b=e2DeBbjtXT2DFXjLlaCdTrqHn3LfjeawvxYcUnpNMwblONfMe2K6mTUfial59S4lvb bW5rvLEp6ZwXyX7IOX/qmEPjQuMzpIyjmVHhAKM2kqWW0hojn9nvf25yVR9dJqQla5xs MCyfzA6H6asuRng04y2mJre6ljPPEQeBNE8I5b9wPpHap86Le0xbWfMmSv+cjkJSokXy s0chpydFrCnFdAVyNiF0+9ZUd34/pKNaiPkyygD2hDSdrLAvE09i665BZHRYRpgBBjlr Cdh6HWT78ZZjlp8Vd25WFv2rq2O+20zcr5GKDr2P3bDDXbT7b47FW1W5zKAjMyhz0N2g J1Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763701506; x=1764306306; h=cc:to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bD/kxunI5AdpL1l1WB/VY1TVoSja9N9k7Lo5f+xNMoY=; b=lRZyAYjI9TrA+hkddxNRR9D2Aa9Dj1NkX0O5Mz9Tj2g6Bt4dCB6LQGoPhI6vcOm1CM 6AAYXz7Dj8uayskZGdrCwK6CCMvo4r+kunCSG/X18P1iwUj0MmPeyP80QdRo3pm/QwjD XoHm03YdPB4sZ09/hvExcaMJeP0+X3cWddGMqSZFF6dyWi7H+7qevx2EHlLyX6A6j1/c lyIXgrGwSctqS+Q3z14Cl/8Blz8NOiKJCJtQ2qxTk4kZ2pO12PkycHwb5GhQ5yRwVpTo 4oxadFzdiogu7MIIjuWcGjsUqSE/0tQrVAok9h27SzWKFTtvZMqmleebJ7peIbsAIvi8 UvdQ== X-Forwarded-Encrypted: i=1; AJvYcCU0UqIUmIDBoxi+ALylZtEBr1Q9+PtzlUHzjEaiWWFaFWzss4hyTg3T/gnFU6XddAb76aXDcrFhIlG9JC8=@vger.kernel.org X-Gm-Message-State: AOJu0Yyb6PzBRlFJLfVS0PNbmNxPKuVJO4wwwuPsAhVpfDz0Gde8hwFv 7XiG0fte+FITV3tMsYrByZwCv9PUWhG8OWkK37QUgU701dXfl1dYxWIrdVdJP1to679Qwb1ff+n vOmFP3IKuaYmY0gzQccgKEyYur7IxYEvztvDAjqDnA9A+oXPlpQIGK3nxQOW7rtvhf+pFgvG8Oc ymfd75dA5PNdpTxaVU4O5PnNAYfNN1BKdHpyvZC+G31rlRd5P7p1M= X-Gm-Gg: ASbGncslHdV6ONvJDPza+iMOBxBmikcpDrbijfh/q8DCLK4Wsu0d2PYH9n5zjUj2CUt WyQo9GNAOpvI8z129lC5sj4+2GYXp5WAa7A6yOsPaSC2b/hiBAoibqGwUKVqxT0gLD2QVBS9IyV HGuz81bfTcG4iDBDITlCFWzcGu6GCZ2Dz5vxkowySWUTOt9rlbrDQLXqKpQgcvJg0CwRY= X-Received: by 2002:a05:690c:3382:b0:786:8331:6a02 with SMTP id 00721157ae682-78a8b56c1c0mr12462687b3.69.1763701506338; Thu, 20 Nov 2025 21:05:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGIjbO92Z83tqhLByVY35E41+vsMACr1OEz2slmB3F8pKUejv4IGvIgka+Ng7cr6HVNQqZjvZDixUVOC78tuUM= X-Received: by 2002:a05:690c:3382:b0:786:8331:6a02 with SMTP id 00721157ae682-78a8b56c1c0mr12462487b3.69.1763701505954; Thu, 20 Nov 2025 21:05:05 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Luke Yang Date: Fri, 21 Nov 2025 00:04:55 -0500 X-Gm-Features: AWmQ_bmDy0u5e9A2yyjX0yGnilVy89lF0nwbbPkrsmq70L9p1eE08B8l02uCUFU Message-ID: Subject: [PATCH] arm64: clear_user: align __arch_clear_user() to 128B for I-cache efficiency To: Catalin Marinas , Will Deacon Cc: Jirka Hladky , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joe Mario Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On aarch64 kernels, recent changes (specifically irqbypass patch https://lore.kernel.org/all/20250516230734.2564775-6-seanjc@google.com/) shifted __arch_clear_user() such that the tight zeroing loop straddles I-cache lines. This causes measurable read performance regression when reading from /dev/zero. Add `.p2align 6` (64-byte alignment) to guarantee the loop stays within a single I-cache boundary, restoring the previous IPC and throughput. Tested on bare-metal aarch64 systems: Good kernel: pread_z100k ~ 6.9 s Bad kernel: pread_z100k ~ 9.0 s With patch: pread_z100k ~ 6.9 s Reproducer: // gcc -O2 -Wall -Wextra -o pread_z100k pread_z100k.c #include #include #include #include #include #include #define SIZE (100 * 1024) #define COUNT 1000000 static double now_sec(void) { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec + tv.tv_usec / 1e6; } int main(void) { int fd =3D open("/dev/zero", O_RDONLY); if (fd < 0) { perror("open /dev/zero"); return 1; } char *buf =3D malloc(SIZE); if (!buf) { perror("malloc"); close(fd); return 1; } double t1 =3D now_sec(); for (int i =3D 0; i < COUNT; i++) { ssize_t r =3D pread(fd, buf, SIZE, 0); if (r !=3D SIZE) { perror("pread"); break; } } double t2 =3D now_sec(); printf("%.6f\n", t2 - t1); close(fd); free(buf); return 0; } Signed-off-by: Luke Yang Signed-off-by: Jirka Hladky --- arch/arm64/lib/clear_user.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S index de9a303b6..91eee4a7c 100644 --- a/arch/arm64/lib/clear_user.S +++ b/arch/arm64/lib/clear_user.S @@ -17,6 +17,11 @@ * Alignment fixed up by hardware. */ +/* + * Ensure __arch_clear_user() always starts on a clean I-cache boundary. + */ + .p2align 6 // 2^6 =3D 64-byte alignment + SYM_FUNC_START(__arch_clear_user) add x2, x0, x1 --=20 2.51.1