Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp944805rdb; Thu, 15 Feb 2024 23:40:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX+zqr5vfQQjuL2dInuqnDmLQ+Jzw/69BQq+ysVhTUHmMaam4pyRI8gy89T8FHn6XzQg4lQqiA26WIPG53nuYln6M11x6KnYmemIGd4dQ== X-Google-Smtp-Source: AGHT+IGsxUSIjf/VkWl8T0jFfmDBGH6fzeeGzE8gf2Pdf45KTmaS7d4aygnNA7dVhPTce3bVxh5H X-Received: by 2002:a17:902:ce01:b0:1db:96d3:3608 with SMTP id k1-20020a170902ce0100b001db96d33608mr3726647plg.2.1708069228516; Thu, 15 Feb 2024 23:40:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708069228; cv=pass; d=google.com; s=arc-20160816; b=Svf98zfwOAwGctkecXIjokGu7X9GsmEJ/nz/Ap/bUstTKJnhJ/pFepQfqKSc2cjEI2 EOj4ZB6kXdXTChMXqct/2JSmm+DSOum2IpCyErQ2uooLocZT0p2x9O+qIXRSStQRAoth kD1NYq720tZVOqFCY9JgQl2j4kuDvc3Um3WJ8ZZuzfW+NIZM/rrsRL6Zek4zkG7Dh71D 7vTyO/GvogFkyrNMelCg1fp9Nvy4mBw4hAsOOdeSMhD4YOI/MweTGTNl8WNZImTCFEVT D5nubRmIrwQPL1M2xKil9AWygonH+ZM8t7oqv4oRgufGLmTACL+jOUjsHE9OZg7diGay SK7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=NxshrGG80BbWlZOzK0oezxyrcU8GM7ykedlzocGaTXw=; fh=Ub95fBsiseQVLo56fdyDA2zH9Ec5p8qFryhFaIE+jLo=; b=KbDuEYqh6PUTWC+1Fj2X363m1h5bHGJRLJ5Z9+UwWrh3EB3pGrnHSEMAS7m4baQa1S Bh83gZJMFTxDXPInkRSxKauJNISvWY5wEWG4CLiCK/cnPrExdVC62rw3WlA0jZfFw7Pn 2BmmXhZ6jfTHbtQ/Bj3SsimimiF2i+KS7tmboRqNczFByNOoL5y++/aPL7SI1ni63Lci AczI2bju2Qup2AAI7lo2ft/Ot7JEoZ8bGxQGdI+oQ8+3z8XE7ZFUxktIg4OKf2xsMSyE JpUPaYLiVxJzpExGkMawe/3IKQJGM7CHBq9LKOnowY+ed0tqNMrHmvG6HdpVBvLovdwE QAJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RHyoB/Zm"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68180-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n5-20020a170902d2c500b001db603f6474si2647693plc.170.2024.02.15.23.40.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 23:40:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RHyoB/Zm"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68180-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 39938B2171F for ; Fri, 16 Feb 2024 07:40:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BA771759D; Fri, 16 Feb 2024 07:40:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RHyoB/Zm" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8CB1B14F64; Fri, 16 Feb 2024 07:40:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708069214; cv=none; b=cXndlbxHPuiRxs/vf0PrrUJpiuJLBiVgPT1Lhc5UcXSSKffS9A+3Q8wf4Xiz2azE2UkDK1wP17q69fGdS2ajs+BEgzanCHSj6dauIbYg2uBgrGgXYWPEK0xIC+mvtHqzx7vL2n/ZKbnwhxypw2gR14p/C86NrCOUipKIFD6H9Cs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708069214; c=relaxed/simple; bh=icz55HJQfZZHEN/btHPRBr3cpgSXuR4YteZ6R/WPaGA=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=LWV7mBLpwmVf2kLccfwyD1TjWVEgJNod7rYabSS7MIPWnAbIuWonw+DiBdeG494vi0GCCFqsSZfuiY3i8+rXaefJ49GkD8eeWb5jrUaWUY0V7QHSNkzMEe7fryi6bYz7/P+CQxdgu1Vgn7nY4Stfp3YCpN4IeVEHCkbAarye9KU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RHyoB/Zm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F255C433C7; Fri, 16 Feb 2024 07:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708069214; bh=icz55HJQfZZHEN/btHPRBr3cpgSXuR4YteZ6R/WPaGA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RHyoB/Zm+aeCpXvsdcAkjZ/8IP0JIcV9o5cVs3hvqpviLm+GagX2Su7pi1IzmbFTI egsQDa7ec2GbV/tx00to1LvWI7cUqCtFZbVRCA+hJ6tEaXpXf2SXZaWIRZf9hW3P3V 14k+yC+cS4EZoFOf1pkEXd7JEIlN1616BOSHmiot2zsknR6TT/hB3pcHYGCYALkUgq 3/MpJEb5Qu0tMkq7dlDZKPDAoDxDeZCr3R26s2hBY9Z/0qPKuuYKzoFX4LlPpaNpZn GHCAEPY6d6nFk7ERFwPg2osOonvSBgwtQb0+uPgrFpnv9+JFklxoEmklr63HlMMVYR 8BGq/CQgSk+6g== Date: Fri, 16 Feb 2024 16:40:07 +0900 From: Masami Hiramatsu (Google) To: Steven Rostedt Cc: Alexei Starovoitov , Florent Revest , linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Mark Rutland , Peter Zijlstra , Thomas Gleixner , Guo Ren Subject: Re: [PATCH v7 19/36] function_graph: Implement fgraph_reserve_data() and fgraph_retrieve_data() Message-Id: <20240216164007.2de685ce5c78cee69e168601@kernel.org> In-Reply-To: <20240214185407.767243b4@gandalf.local.home> References: <170723204881.502590.11906735097521170661.stgit@devnote2> <170723226123.502590.4924916690354403889.stgit@devnote2> <20240214135958.23ed55e1@gandalf.local.home> <20240215084552.b72d6d22ce1b93bb8e04b70a@kernel.org> <20240214185407.767243b4@gandalf.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 14 Feb 2024 18:54:07 -0500 Steven Rostedt wrote: > On Thu, 15 Feb 2024 08:45:52 +0900 > Masami Hiramatsu (Google) wrote: > > > > Hmm, the above is a fast path. I wonder if we should add a patch to make that into: > > > > > > if (unlikely(size_bytes & (sizeof(long) - 1))) > > > data_size = DIV_ROUND_UP(size_bytes, sizeof(long)); > > > else > > > data_size = size_bytes >> (sizeof(long) == 4 ? 2 : 3); > > > > > > to keep from doing the division. > > > > OK, I thought DIV_ROUND_UP was not much cost. Since sizeof(long) is > > fixed 4 or 8, so > > > > data_size = (size_bytes + sizeof(long) - 1) >> BITS_PER_LONG; > > > > will this work? > > No, because BITS_PER_LONG is 32 or 64 ;-) Oops indeed. > > But this should; > > data_size = (size_bytes + sizeof(long) - 1) >> (sizeof(long) == 4 ? 2 : 3); > > As sizeof(long) is a constant, that conditional expression will be hard > coded into either 2 or 3 by the compiler. Yeah. OK, let me update it. Thank you, > > -- Steve -- Masami Hiramatsu (Google)