Skip to content

Consolidate private allocations in seq files

Pavel Emelyanov netdev 1 version Applied

Status from this message: Applied, nice cleanup Pavel.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 6 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/6Introduce the seq_open_private()fs/seq_file.c include/linux/seq_file.h+35 -01 reply
2/6Make core networking code use seq_open_privatenet/ipv4/arp.c net/ipv4/fib_hash.c net/ipv4/fib_trie.c +12 more+37 -3351 reply
3/6Make netfilter code use the seq_open_privatenet/ipv4/netfilter/ipt_recent.c net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c net/netfilter/nf_conntrack_expect.c +3 more+14 -1091 reply
4/6Make decnet code use the seq_open_private()net/decnet/dn_neigh.c net/decnet/dn_route.c+4 -351 reply
5/6Make the IRDA use the seq_open_private()net/irda/irlap.c net/irda/irlmp.c net/irda/irttp.c+8 -601 reply
6/6Make the sunrpc use the seq_open_private()net/sunrpc/cache.c+2 -101 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6][NET-2.6.24] Consolidate private allocations in seq files

Many (very many) seq files in net/ allocate some private data to use it later (mostly for iteration state). All this code was obviously get using copy-paste method, so move it into one place.

Almost all of these places either set this private to 0, or keep uninitialized. Some places, however, pre-initialize this area, but there are few of them.

The seq_open_private() call just opens the seq file with allocated and set to zero area. The __seq_open_private() call makes the same, but returns the allocated memory to the called to be initialized later.

I didn't measure how much of the .text section this saves, but I suspect a lot of :) As far as the code is concerned, this set saves ~450 lines.

Such thing may be useful for any subsystem, but I found this mostly in the networking code and fixed only it (for a while).