Re: netlink vs. debugfs (was Re: [Patch 0/6] statistics infrastructure)

From: Balbir Singh
Date: Mon May 22 2006 - 14:37:53 EST

On Mon, May 22, 2006 at 11:09:22AM -0700, Tim Bird wrote:
> Andrew Morton wrote:
> > Martin Peschke <mp3@xxxxxxxxxx> wrote:
> >> My patch series is a proposal for a generic implementation of statistics.
> >
> > This uses debugfs for the user interface, but the
> > per-task-delay-accounting-*.patch series from Balbir creates an extensible
> > netlink-based system for passing instrumentation results back to userspace.
> >
> > Can this code be converted to use those netlink interfaces, or is Balbir's
> > approach unsuitable, or hasn't it even been considered, or what?
> Can someone give me the 20-second elevator pitch on why
> netlink is preferred over debugfs? I've heard of a
> number of debugfs/procfs users requested to switch over.
> Thanks,
> -- Tim
> =============================
> Tim Bird
> Architecture Group Chair, CE Linux Forum
> Senior Staff Engineer, Sony Electronics
> =============================

Hi, Tim,

I am no debugfs expert, I hope I can do justice to the comparison.

Debugfs Netlink/Genetlink

1. Filesystem based - requires creating Several types of data can
files for each type of data passed be multiplexed over one netlink
down socket.
2. Hard to determine record format/data Contains metadata including
type of data and length
with each record
3. Notifications are hard Notifications are very easy
I think they can be done using inotify good library support for
notifications. Data can
either be broadcast or
selectively mulitcast
4. Requires several open/read/write/close A single socket can be
operations opened, data from kernel
space can be multiplexed
over it.

I don't think I did any justice to the advantages of debugfs. The only
one I can think of is that it uses relayfs. Relayfs is efficient in the
sense that it uses per-cpu buffers.

Anybody else want to take a shot in comparing the two?

Balbir Singh,
Linux Technology Center,
IBM Software Labs
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at