From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172]) (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 932FF14B96E for ; Wed, 7 Jan 2026 00:54:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767747272; cv=none; b=DhCT5B6CKSbnf8gL7JRS3OVbAKVUUraNTjFdE41P6HefFe3G/i/BfRsa5Y/05guV8fM/FDg6ZLT07ifBobHbCxH4u0Lj9+/o3V7ctR4tencNTlrdJ4ZKBz6svCz/fB1bTyN01y4NAYRl8iSZm2AMZaM+Kz4DfPBh2GGxXu0Suk0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767747272; c=relaxed/simple; bh=tHVIlxd0OrYfUfL9QitxcVudnAJjLfhW9l0XkGQiuH8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dpi/++TNDmzz/xfel00z/tdSr7XPIk+eRnvesh+FMta/Bif0l+zDwFAeSGPACpFD5qgul2e4aJ13jiSJIQhSulXWrPxI+LcsXXJsaDQYpav6tbHg5b2yiU+I+B9JjJgTJT8NT0r7KrAIcAL/gOucO6uTiaIZV5mxH/Dy8tK6s7c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iHEDrhv4; arc=none smtp.client-ip=74.125.82.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iHEDrhv4" Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-2ad70765db9so1226280eec.1 for ; Tue, 06 Jan 2026 16:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767747270; x=1768352070; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=nKFtuRxvG8Sc4Hw9c2NIcUDhbvE2DGMRpi93OKfcQC4=; b=iHEDrhv4yb34Zb2vJPOtSFInXPMzSKZTYQpnvtByooPDiDCpVM553QDL5PcVY+ll4R +KlluRjarKKZVl0fhZNJvd64q+AUzqcGuyG3pAhwagzhV7YzV7UstL2odQmLjk9J1mHK Vjoi/hvcI/v7ukRS3eqLjcFtEymQU8PEfWadOD859uIo21Hy+67p2hnmWhvtHphGPQoS 9oYpYb/rogmyXmFQX8eh+clLFwdemLSKuMv3TEN4cT51DDPLnp5HD3hL+7AulzokJQ8J tE5j0FPkq0EGe18PREp80NyQT4cOkt+IVQ7x4iq9FjOne3IRyd/zPRirpq+CuK624rJM MC8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767747270; x=1768352070; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=nKFtuRxvG8Sc4Hw9c2NIcUDhbvE2DGMRpi93OKfcQC4=; b=so4PrsXo/ryTs84vy5or2++kFouxT+oSUOqduQa9bJ3oCAlhfx4Zjw8EMoDSQkpsRR /T/nlh9YBsmUfhnH2hIaIvusBMJHpQX94SMCR1Y3dI5uk+YbLzzIQZ/Vw+aplWFAFodK G/DQxv5cXKXDj8XAeu4T+OrbIQTXKDnc17ep6t4eypsjTHATHVAyLF8Rn2kf00+s849q 5mxeos2zKAqx4S9kfEDkSXWt4sqpcETdpBz3ivRfAPOYH5YiGbDMO7N6+4E84yt8kNpT b/J5GH8XM/DDUujOatoj0s7CLoc1XkTR60fq3GrFlsVip5+6irsVzHTMG7Adjneq6SVm e2Lw== X-Forwarded-Encrypted: i=1; AJvYcCV8IesWC49z/xDmbiz11x9RaBxBtaQ0WNuJKc70oj2zMvfowgRrGuklXAN779iq+ePXZpaTPJSCUibPiOg=@vger.kernel.org X-Gm-Message-State: AOJu0YxFSFjTvkok/6zGPI4EzlaAg3hscwx78f/n4GShS0fAEBeHOqoB mIWA91TdLrzWrg5fhvuDElU9MRn8nCIZDRlX+cstTtsfOaiJgv9VxUbL X-Gm-Gg: AY/fxX6LLFAXAZ3F558Fwe4xfns6VTUAIfzswNV8KgPSEvX1G+gNa68Y3zZFuhGZqhL +qVxsgA/sQ5AximouyHtdyTb4EwrVNeeOBsj/YfRwgI8KQe+tAKzOXvCV975XyHrhJlN/PitCeQ tfpqJdyluYs6pfdyXPxMx0ddKiedstM6OljuDP0WS4/2yNtg83YIkzwXos4Aq4w3dzTSar7oTem 6Hqx6m/EhEkdRrtVuzHGFG/98nOAEbh+Kk+f1P1sFOvgJoKkzLgTyPxAu+vgVF0GW+VEw3RTHmF Q32l6lCH8DndvdWYwfMW/NY4ix383rdgsgkwyObq+E9mSV4/N/FQA/1rzbUNd0Q2ach0oFyp+Yo 6oyd3Gc3pQH4QQOzoi7OLoqRp+NtPX/5R6IfpWmYJpCUVnjXGTgbp2l08uGFwBKFhEPRYZtV0D4 Up6R7tecqK+39M3Uc0xVIRvmuY X-Google-Smtp-Source: AGHT+IHB6AOl+mK8nO1d90rNd5G0CXOq/nrjk54nUlOimZbEwbghfsrd5mTOmHUoD0CDyiPS/VTFbQ== X-Received: by 2002:a05:693c:60ca:b0:2b0:5435:2e04 with SMTP id 5a478bee46e88-2b17d266983mr767010eec.19.1767747269549; Tue, 06 Jan 2026 16:54:29 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:da43:aeff:fecc:bfd5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b17078dd78sm5350516eec.19.2026.01.06.16.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 16:54:29 -0800 (PST) Sender: Guenter Roeck Date: Tue, 6 Jan 2026 16:54:27 -0800 From: Guenter Roeck To: Steven Rostedt Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH v2] ftrace: Do not over-allocate ftrace memory Message-ID: References: <20260107002428.2904852-1-linux@roeck-us.net> <20260106194355.66cf869e@fedora> 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-Disposition: inline In-Reply-To: <20260106194355.66cf869e@fedora> On Tue, Jan 06, 2026 at 07:43:55PM -0500, Steven Rostedt wrote: > > > > @@ -7304,30 +7305,6 @@ static int ftrace_process_locs(struct module *mod, > > > > /* We should have used all pages unless we skipped some */ > > if (pg_unuse) { > > - unsigned long pg_remaining, remaining = 0; > > - unsigned long skip; > > - > > - /* Count the number of entries unused and compare it to skipped. */ > > - pg_remaining = (ENTRIES_PER_PAGE << pg->order) - pg->index; > > - > > - if (!WARN(skipped < pg_remaining, "Extra allocated pages for ftrace")) { > > - > > - skip = skipped - pg_remaining; > > - > > - for (pg = pg_unuse; pg; pg = pg->next) > > - remaining += 1 << pg->order; > > - > > - pages -= remaining; > > - > > - skip = DIV_ROUND_UP(skip, ENTRIES_PER_PAGE); > > - > > - /* > > - * Check to see if the number of pages remaining would > > - * just fit the number of entries skipped. > > - */ > > - WARN(skip != remaining, "Extra allocated pages for ftrace: %lu with %lu skipped", > > - remaining, skipped); > > - } > > Don't remove this block. It's still needed. A lot of entries are > skipped when adding the records. Weak functions and zero'd pointers > that were part of the count are skipped. This is the code that handles > that. It has nothing to do with rounding errors. > Sorry, misunderstanding. I thought that is what you meant with "This will make pages equal the number of pages that were allocated. Then I'm not sure we need this extra logic." What is the no longer needed extra logic ? Thanks, Guenter