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: <alpine.DEB.2.00.0904302311320.20374@gandalf.stny.rr.com>
Date:	Thu, 30 Apr 2009 23:11:52 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH 1/3] ring-buffer: add counters for commit overrun and
 nmi dropped entries


On Thu, 30 Apr 2009, Andrew Morton wrote:

> On Thu, 30 Apr 2009 22:22:11 -0400 Steven Rostedt <rostedt@...dmis.org> wrote:
> 
> > +unsigned long ring_buffer_nmi_dropped_cpu(struct ring_buffer *buffer, int cpu)
> > +{
> > +	struct ring_buffer_per_cpu *cpu_buffer;
> > +	unsigned long ret;
> > +
> > +	if (!cpumask_test_cpu(cpu, buffer->cpumask))
> > +		return 0;
> > +
> > +	cpu_buffer = buffer->buffers[cpu];
> > +	ret = cpu_buffer->nmi_dropped;
> > +
> > +	return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(ring_buffer_nmi_dropped_cpu);
> > +
> > +/**
> > + * ring_buffer_commit_overrun_cpu - get the number of overruns caused by commits
> > + * @buffer: The ring buffer
> > + * @cpu: The per CPU buffer to get the number of overruns from
> > + */
> > +unsigned long
> > +ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu)
> > +{
> > +	struct ring_buffer_per_cpu *cpu_buffer;
> > +	unsigned long ret;
> > +
> > +	if (!cpumask_test_cpu(cpu, buffer->cpumask))
> > +		return 0;
> > +
> > +	cpu_buffer = buffer->buffers[cpu];
> > +	ret = cpu_buffer->commit_overrun;
> > +
> > +	return ret;
> > +}
> 
> hm.  Four functions in a row, all of which differ in but a single line.
> 
> unsigned long
> ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu)
> {
> 	return some_common_function(buffer, cpu)->commit_overrun;
> }
> 
> ?

But that actually takes thought. I like my cut and paste ;-)

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ