Skip to contentSkip to conversation

Use list_head-s in inetpeer.c

PATCH In review Pavel Emelyanov 2 participants 4 messages Nov 10, 2007 – Nov 12, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use list_head-s in inetpeer.c

The inetpeer.c tracks the LRU list of inet_perr-s, but makes it by hands. Use the list_head-s for this.

---

include/net/inetpeer.h +1 -1
index aa10a81..ad8404b 100644
@@ -22,7 +22,7 @@ struct inet_peer
 	__be32			v4daddr;	/* peer's address */
 	__u16			avl_height;
 	__u16			ip_id_count;	/* IP ID for the next packet */
-	struct inet_peer	*unused_next, **unused_prevp;
+	struct list_head	unused;
 	__u32			dtime;		/* the time of last use of not
 						 * referenced entries */
 	atomic_t		refcnt;
net/ipv4/inetpeer.c +15 -27

86 lines not on this page · raw message

Signature · 1 line
1.5.3.4
maintainer
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Sat, 10 Nov 2007 17:32:58 +0300

Quoted 4 lines

The inetpeer.c tracks the LRU list of inet_perr-s, but makes it by hands. Use the list_head-s for this.

This makes every inetpeer struct consume 8 more bytes, and on some systems we have can have many of these objects active. That space savings is why this was done the way it was.

It would be nice to have "tailq" like interfaces in linux/list.h for situations like this.

Please do not submit a patch implementing that until the 2.6.25 merge window, however, thanks.

#2 lore raw
Quoted 11 lines · David Miller

From: Pavel Emelyanov <[email protected]>
Date: Sat, 10 Nov 2007 17:32:58 +0300

Quoted 4 lines

The inetpeer.c tracks the LRU list of inet_perr-s, but makes it by hands. Use the list_head-s for this.

This makes every inetpeer struct consume 8 more bytes, and on some systems we have can have many of these objects active. That space savings is why this was done the way it was.

No. I remove _two_ pointers unused_next and unused_prevp, and add the list_head, which is _two_ pointers as well. I've even checked the compilation on both i386 and x86_64 - the sizeof(struct inet_peer) is not changed.

You must have overlooked the unused_prevp member, because it is declared in the same line as the unused_next. Or I miss something else?

Quoted 5 lines

It would be nice to have "tailq" like interfaces in linux/list.h for situations like this.

Please do not submit a patch implementing that until the 2.6.25 merge window, however, thanks.

If my explanation above is correct, should I delay this patch until the 2.6.25 anyway?

Thanks,
Pavel

maintainer
#3 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Mon, 12 Nov 2007 11:57:23 +0300

Quoted 7 lines

No. I remove _two_ pointers unused_next and unused_prevp, and add the list_head, which is _two_ pointers as well. I've even checked the compilation on both i386 and x86_64 - the sizeof(struct inet_peer) is not changed.

You must have overlooked the unused_prevp member, because it is declared in the same line as the unused_next. Or I miss something else?

I missed that, please resubmit your patch.

Thanks.