lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b13af4e1-3510-4240-9347-31459d5f0ef6@roeck-us.net>
Date: Tue, 6 Jan 2026 16:54:27 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v2] ftrace: Do not over-allocate ftrace memory

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ