Skip to contentSkip to conversation

Driver Core update for 2.6.4

PATCH Andi Kleen 4 participants 5 messages Mar 16, 2004 – Mar 19, 2004 4 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#4 lore raw
Quoted 4 lines · Andrew Morton

eh? If there is any argument against this code it is that it is so simple that the thing which it abstracts is not worth abstracting. But given that it is so unwasteful, this seems unimportant.

The bloat argument was about the additional pointer in the dynamic data structure (on a 64bit architecture it costs 12 bytes)

Better would be to pass the callback to kref_put(), but then it would be even better to just test the return value (callbacks are obfuscation and should be avoided when not needed)

-Andi

#5 lore raw
Quoted 8 lines · Andi Kleen
Quoted 4 lines · Andrew Morton

eh? If there is any argument against this code it is that it is so simple that the thing which it abstracts is not worth abstracting. But given that it is so unwasteful, this seems unimportant.

The bloat argument was about the additional pointer in the dynamic data structure (on a 64bit architecture it costs 12 bytes)

Well balance that out against every usb driver re-implemeting the same get/put logic with an atomic counter and that "bloat of a pointer" just got lost in the noise of the extra kernel code size increase :)

Quoted 3 lines

Better would be to pass the callback to kref_put(), but then it would be even better to just test the return value (callbacks are obfuscation and should be avoided when not needed)

You don't always have the same chunk of code doing the last kref_put() as the one where we know the release function is at. See the kobject/driver model code for an example of this.

thanks,

greg k-h

author
#6 lore raw
Quoted 7 lines · Greg KH
Quoted 6 lines · Andi Kleen
Quoted 4 lines · Andrew Morton

eh? If there is any argument against this code it is that it is so simple that the thing which it abstracts is not worth abstracting. But given that it is so unwasteful, this seems unimportant.

Quoted 5 lines
Quoted 2 lines

The bloat argument was about the additional pointer in the dynamic data structure (on a 64bit architecture it costs 12 bytes)

Well balance that out against every usb driver re-implemeting the same get/put logic with an atomic counter and that "bloat of a pointer" just

Yes, all those one and two liners duplicated ... scary.

Quoted 1 line

got lost in the noise of the extra kernel code size increase :)

Have you ever looked how many instructions

	if (!atomic_dec_and_test(&foo->ref))
		release(foo) 

generated? Code size makes no difference here at all.

Dynamic object bloat is much worse than code bloat anyways because you can have thousands of these objects.

-Andi

#7 lore raw
In reply to Andi Kleen
Quoted 6 lines · Andi Kleen
Quoted 3 lines

eh? If there is any argument against this code it is that it is so simple that the thing which it abstracts is not worth abstracting. But given that it is so unwasteful, this seems unimportant.

The bloat argument was about the additional pointer in the dynamic data structure (on a 64bit architecture it costs 12 bytes)

This is one place where C++-style vtable inheritance would help.
Many of those *_operations tables could logically derive from a kref_operations table.

I doubt if there is a nice to way to represent it with C macros, but maybe there is.

-- Jamie

#8 lore raw
Quoted 5 lines · Jamie Lokier
Quoted 4 lines · Andi Kleen
Quoted 3 lines

eh? If there is any argument against this code it is that it is so simple that the thing which it abstracts is not worth abstracting. But given that it is so unwasteful, this seems unimportant.

Quoted 8 lines
Quoted 2 lines

The bloat argument was about the additional pointer in the dynamic data structure (on a 64bit architecture it costs 12 bytes)

This is one place where C++-style vtable inheritance would help.
Many of those *_operations tables could logically derive from a kref_operations table.

I doubt if there is a nice to way to represent it with C macros, but maybe there is.

(Stupid idea) Has anybody thought about using "Lightweight C++"?

Signature · 7 lines
Giuseppe "Oblomov" Bilotta

Can't you see
It all makes perfect sense
Expressed in dollar and cents
Pounds shillings and pence
                  (Roger Waters)