All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-02-27 16:56 ` tom.leiming at gmail.com
  0 siblings, 0 replies; 22+ messages in thread
From: tom.leiming @ 2010-02-27 16:56 UTC (permalink / raw)
  To: lrodriguez
  Cc: linux-wireless, ath9k-devel, linville, johannes, stable, Ming Lei

From: Ming Lei <tom.leiming@gmail.com>

The patch defines the fields of 'valid_single_stream' and 'valid' in
struct ath_rate_table as char type, so decrease the size of ath9k.ko
about 2KB.

old ath9k.ko
[tom@tom-lei ath9k]$ size ath9k.ko
   text    data     bss     dec     hex filename
  69344    3080     168   72592   11b90 ath9k.ko

new ath9k.ko
[tom@tom-lei ath9k]$ size ath9k.ko
   text    data     bss     dec     hex filename
  67304    3080     168   70552   11398 ath9k.ko

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/net/wireless/ath/ath9k/rc.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
index 4f6d6fd..389168a 100644
--- a/drivers/net/wireless/ath/ath9k/rc.h
+++ b/drivers/net/wireless/ath/ath9k/rc.h
@@ -110,8 +110,8 @@ struct ath_rate_table {
 	int rate_cnt;
 	int mcs_start;
 	struct {
-		int valid;
-		int valid_single_stream;
+		char valid;
+		char valid_single_stream;
 		u8 phy;
 		u32 ratekbps;
 		u32 user_ratekbps;
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-02-27 16:56 ` tom.leiming at gmail.com
  0 siblings, 0 replies; 22+ messages in thread
From: tom.leiming at gmail.com @ 2010-02-27 16:56 UTC (permalink / raw)
  To: ath9k-devel

From: Ming Lei <tom.leiming@gmail.com>

The patch defines the fields of 'valid_single_stream' and 'valid' in
struct ath_rate_table as char type, so decrease the size of ath9k.ko
about 2KB.

old ath9k.ko
[tom at tom-lei ath9k]$ size ath9k.ko
   text    data     bss     dec     hex filename
  69344    3080     168   72592   11b90 ath9k.ko

new ath9k.ko
[tom at tom-lei ath9k]$ size ath9k.ko
   text    data     bss     dec     hex filename
  67304    3080     168   70552   11398 ath9k.ko

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/net/wireless/ath/ath9k/rc.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
index 4f6d6fd..389168a 100644
--- a/drivers/net/wireless/ath/ath9k/rc.h
+++ b/drivers/net/wireless/ath/ath9k/rc.h
@@ -110,8 +110,8 @@ struct ath_rate_table {
 	int rate_cnt;
 	int mcs_start;
 	struct {
-		int valid;
-		int valid_single_stream;
+		char valid;
+		char valid_single_stream;
 		u8 phy;
 		u32 ratekbps;
 		u32 user_ratekbps;
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH] ath9k: decrease size of ath9k.ko
  2010-02-27 16:56 ` [ath9k-devel] " tom.leiming at gmail.com
@ 2010-02-27 17:10   ` Larry Finger
  -1 siblings, 0 replies; 22+ messages in thread
From: Larry Finger @ 2010-02-27 17:10 UTC (permalink / raw)
  To: tom.leiming
  Cc: lrodriguez, linux-wireless, ath9k-devel, linville, johannes, stable

On 02/27/2010 10:56 AM, tom.leiming@gmail.com wrote:
> From: Ming Lei <tom.leiming@gmail.com>
> 
> The patch defines the fields of 'valid_single_stream' and 'valid' in
> struct ath_rate_table as char type, so decrease the size of ath9k.ko
> about 2KB.
> 
> old ath9k.ko
> [tom@tom-lei ath9k]$ size ath9k.ko
>    text    data     bss     dec     hex filename
>   69344    3080     168   72592   11b90 ath9k.ko
> 
> new ath9k.ko
> [tom@tom-lei ath9k]$ size ath9k.ko
>    text    data     bss     dec     hex filename
>   67304    3080     168   70552   11398 ath9k.ko
> 
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
>  drivers/net/wireless/ath/ath9k/rc.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
> index 4f6d6fd..389168a 100644
> --- a/drivers/net/wireless/ath/ath9k/rc.h
> +++ b/drivers/net/wireless/ath/ath9k/rc.h
> @@ -110,8 +110,8 @@ struct ath_rate_table {
>  	int rate_cnt;
>  	int mcs_start;
>  	struct {
> -		int valid;
> -		int valid_single_stream;
> +		char valid;
> +		char valid_single_stream;
>  		u8 phy;
>  		u32 ratekbps;
>  		u32 user_ratekbps;

Why 'char' rather than 'u8'? To me, the latter implies a small integer, not
character data.

Larry


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-02-27 17:10   ` Larry Finger
  0 siblings, 0 replies; 22+ messages in thread
From: Larry Finger @ 2010-02-27 17:10 UTC (permalink / raw)
  To: ath9k-devel

On 02/27/2010 10:56 AM, tom.leiming at gmail.com wrote:
> From: Ming Lei <tom.leiming@gmail.com>
> 
> The patch defines the fields of 'valid_single_stream' and 'valid' in
> struct ath_rate_table as char type, so decrease the size of ath9k.ko
> about 2KB.
> 
> old ath9k.ko
> [tom at tom-lei ath9k]$ size ath9k.ko
>    text    data     bss     dec     hex filename
>   69344    3080     168   72592   11b90 ath9k.ko
> 
> new ath9k.ko
> [tom at tom-lei ath9k]$ size ath9k.ko
>    text    data     bss     dec     hex filename
>   67304    3080     168   70552   11398 ath9k.ko
> 
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
>  drivers/net/wireless/ath/ath9k/rc.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
> index 4f6d6fd..389168a 100644
> --- a/drivers/net/wireless/ath/ath9k/rc.h
> +++ b/drivers/net/wireless/ath/ath9k/rc.h
> @@ -110,8 +110,8 @@ struct ath_rate_table {
>  	int rate_cnt;
>  	int mcs_start;
>  	struct {
> -		int valid;
> -		int valid_single_stream;
> +		char valid;
> +		char valid_single_stream;
>  		u8 phy;
>  		u32 ratekbps;
>  		u32 user_ratekbps;

Why 'char' rather than 'u8'? To me, the latter implies a small integer, not
character data.

Larry

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] ath9k: decrease size of ath9k.ko
  2010-02-27 17:10   ` [ath9k-devel] " Larry Finger
@ 2010-02-28  2:52     ` Ming Lei
  -1 siblings, 0 replies; 22+ messages in thread
From: Ming Lei @ 2010-02-28  2:52 UTC (permalink / raw)
  To: Larry Finger
  Cc: lrodriguez, linux-wireless, ath9k-devel, linville, johannes, stable

2010/2/28 Larry Finger <Larry.Finger@lwfinger.net>:
> On 02/27/2010 10:56 AM, tom.leiming@gmail.com wrote:
>> From: Ming Lei <tom.leiming@gmail.com>
>>
>> The patch defines the fields of 'valid_single_stream' and 'valid' in
>> struct ath_rate_table as char type, so decrease the size of ath9k.ko
>> about 2KB.
>>
>> old ath9k.ko
>> [tom@tom-lei ath9k]$ size ath9k.ko
>>    text    data     bss     dec     hex filename
>>   69344    3080     168   72592   11b90 ath9k.ko
>>
>> new ath9k.ko
>> [tom@tom-lei ath9k]$ size ath9k.ko
>>    text    data     bss     dec     hex filename
>>   67304    3080     168   70552   11398 ath9k.ko
>>
>> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
>> ---
>>  drivers/net/wireless/ath/ath9k/rc.h |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
>> index 4f6d6fd..389168a 100644
>> --- a/drivers/net/wireless/ath/ath9k/rc.h
>> +++ b/drivers/net/wireless/ath/ath9k/rc.h
>> @@ -110,8 +110,8 @@ struct ath_rate_table {
>>       int rate_cnt;
>>       int mcs_start;
>>       struct {
>> -             int valid;
>> -             int valid_single_stream;
>> +             char valid;
>> +             char valid_single_stream;
>>               u8 phy;
>>               u32 ratekbps;
>>               u32 user_ratekbps;
>
> Why 'char' rather than 'u8'? To me, the latter implies a small integer, not
> character data.

Either 'char' or 'u8' is OK, since both has one-byte size, isn't it?

Thanks,

-- 
Lei Ming

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-02-28  2:52     ` Ming Lei
  0 siblings, 0 replies; 22+ messages in thread
From: Ming Lei @ 2010-02-28  2:52 UTC (permalink / raw)
  To: ath9k-devel

2010/2/28 Larry Finger <Larry.Finger@lwfinger.net>:
> On 02/27/2010 10:56 AM, tom.leiming at gmail.com wrote:
>> From: Ming Lei <tom.leiming@gmail.com>
>>
>> The patch defines the fields of 'valid_single_stream' and 'valid' in
>> struct ath_rate_table as char type, so decrease the size of ath9k.ko
>> about 2KB.
>>
>> old ath9k.ko
>> [tom at tom-lei ath9k]$ size ath9k.ko
>> ? ?text ? ?data ? ? bss ? ? dec ? ? hex filename
>> ? 69344 ? ?3080 ? ? 168 ? 72592 ? 11b90 ath9k.ko
>>
>> new ath9k.ko
>> [tom at tom-lei ath9k]$ size ath9k.ko
>> ? ?text ? ?data ? ? bss ? ? dec ? ? hex filename
>> ? 67304 ? ?3080 ? ? 168 ? 70552 ? 11398 ath9k.ko
>>
>> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
>> ---
>> ?drivers/net/wireless/ath/ath9k/rc.h | ? ?4 ++--
>> ?1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
>> index 4f6d6fd..389168a 100644
>> --- a/drivers/net/wireless/ath/ath9k/rc.h
>> +++ b/drivers/net/wireless/ath/ath9k/rc.h
>> @@ -110,8 +110,8 @@ struct ath_rate_table {
>> ? ? ? int rate_cnt;
>> ? ? ? int mcs_start;
>> ? ? ? struct {
>> - ? ? ? ? ? ? int valid;
>> - ? ? ? ? ? ? int valid_single_stream;
>> + ? ? ? ? ? ? char valid;
>> + ? ? ? ? ? ? char valid_single_stream;
>> ? ? ? ? ? ? ? u8 phy;
>> ? ? ? ? ? ? ? u32 ratekbps;
>> ? ? ? ? ? ? ? u32 user_ratekbps;
>
> Why 'char' rather than 'u8'? To me, the latter implies a small integer, not
> character data.

Either 'char' or 'u8' is OK, since both has one-byte size, isn't it?

Thanks,

-- 
Lei Ming

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] ath9k: decrease size of ath9k.ko
  2010-02-28  2:52     ` [ath9k-devel] " Ming Lei
@ 2010-02-28  3:19       ` Larry Finger
  -1 siblings, 0 replies; 22+ messages in thread
From: Larry Finger @ 2010-02-28  3:19 UTC (permalink / raw)
  To: Ming Lei
  Cc: lrodriguez, linux-wireless, ath9k-devel, linville, johannes, stable

On 02/27/2010 08:52 PM, Ming Lei wrote:
> 2010/2/28 Larry Finger <Larry.Finger@lwfinger.net>:
>> On 02/27/2010 10:56 AM, tom.leiming@gmail.com wrote:
>>> From: Ming Lei <tom.leiming@gmail.com>
>>>
>>> The patch defines the fields of 'valid_single_stream' and 'valid' in
>>> struct ath_rate_table as char type, so decrease the size of ath9k.ko
>>> about 2KB.
>>>
>>> old ath9k.ko
>>> [tom@tom-lei ath9k]$ size ath9k.ko
>>>    text    data     bss     dec     hex filename
>>>   69344    3080     168   72592   11b90 ath9k.ko
>>>
>>> new ath9k.ko
>>> [tom@tom-lei ath9k]$ size ath9k.ko
>>>    text    data     bss     dec     hex filename
>>>   67304    3080     168   70552   11398 ath9k.ko
>>>
>>> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
>>> ---
>>>  drivers/net/wireless/ath/ath9k/rc.h |    4 ++--
>>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
>>> index 4f6d6fd..389168a 100644
>>> --- a/drivers/net/wireless/ath/ath9k/rc.h
>>> +++ b/drivers/net/wireless/ath/ath9k/rc.h
>>> @@ -110,8 +110,8 @@ struct ath_rate_table {
>>>       int rate_cnt;
>>>       int mcs_start;
>>>       struct {
>>> -             int valid;
>>> -             int valid_single_stream;
>>> +             char valid;
>>> +             char valid_single_stream;
>>>               u8 phy;
>>>               u32 ratekbps;
>>>               u32 user_ratekbps;
>>
>> Why 'char' rather than 'u8'? To me, the latter implies a small integer, not
>> character data.
> 
> Either 'char' or 'u8' is OK, since both has one-byte size, isn't it?

It wasn't the size, but the content implied by the type.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-02-28  3:19       ` Larry Finger
  0 siblings, 0 replies; 22+ messages in thread
From: Larry Finger @ 2010-02-28  3:19 UTC (permalink / raw)
  To: ath9k-devel

On 02/27/2010 08:52 PM, Ming Lei wrote:
> 2010/2/28 Larry Finger <Larry.Finger@lwfinger.net>:
>> On 02/27/2010 10:56 AM, tom.leiming at gmail.com wrote:
>>> From: Ming Lei <tom.leiming@gmail.com>
>>>
>>> The patch defines the fields of 'valid_single_stream' and 'valid' in
>>> struct ath_rate_table as char type, so decrease the size of ath9k.ko
>>> about 2KB.
>>>
>>> old ath9k.ko
>>> [tom at tom-lei ath9k]$ size ath9k.ko
>>>    text    data     bss     dec     hex filename
>>>   69344    3080     168   72592   11b90 ath9k.ko
>>>
>>> new ath9k.ko
>>> [tom at tom-lei ath9k]$ size ath9k.ko
>>>    text    data     bss     dec     hex filename
>>>   67304    3080     168   70552   11398 ath9k.ko
>>>
>>> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
>>> ---
>>>  drivers/net/wireless/ath/ath9k/rc.h |    4 ++--
>>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
>>> index 4f6d6fd..389168a 100644
>>> --- a/drivers/net/wireless/ath/ath9k/rc.h
>>> +++ b/drivers/net/wireless/ath/ath9k/rc.h
>>> @@ -110,8 +110,8 @@ struct ath_rate_table {
>>>       int rate_cnt;
>>>       int mcs_start;
>>>       struct {
>>> -             int valid;
>>> -             int valid_single_stream;
>>> +             char valid;
>>> +             char valid_single_stream;
>>>               u8 phy;
>>>               u32 ratekbps;
>>>               u32 user_ratekbps;
>>
>> Why 'char' rather than 'u8'? To me, the latter implies a small integer, not
>> character data.
> 
> Either 'char' or 'u8' is OK, since both has one-byte size, isn't it?

It wasn't the size, but the content implied by the type.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] ath9k: decrease size of ath9k.ko
  2010-02-28  2:52     ` [ath9k-devel] " Ming Lei
@ 2010-03-01 12:19       ` Holger Schurig
  -1 siblings, 0 replies; 22+ messages in thread
From: Holger Schurig @ 2010-03-01 12:19 UTC (permalink / raw)
  To: Ming Lei
  Cc: Larry Finger, lrodriguez, linux-wireless, ath9k-devel, linville,
	johannes, stable

> Either 'char' or 'u8' is OK, since both has one-byte size, isn't it?

Besides Johannes' comment: char is signed, u8 is unsigned. This can sometimes 
byte you.

-- 
http://www.holgerschurig.de

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-03-01 12:19       ` Holger Schurig
  0 siblings, 0 replies; 22+ messages in thread
From: Holger Schurig @ 2010-03-01 12:19 UTC (permalink / raw)
  To: ath9k-devel

> Either 'char' or 'u8' is OK, since both has one-byte size, isn't it?

Besides Johannes' comment: char is signed, u8 is unsigned. This can sometimes 
byte you.

-- 
http://www.holgerschurig.de

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] ath9k: decrease size of ath9k.ko
  2010-02-28  3:19       ` [ath9k-devel] " Larry Finger
@ 2010-03-01 15:13         ` Ming Lei
  -1 siblings, 0 replies; 22+ messages in thread
From: Ming Lei @ 2010-03-01 15:13 UTC (permalink / raw)
  To: Larry Finger; +Cc: lrodriguez, linux-wireless, ath9k-devel, linville, johannes


>From e74b075cdb143d45be9b371ee8a8e2dcfc15ab34 Mon Sep 17 00:00:00 2001
From: Ming Lei <tom.leiming@gmail.com>
Date: Sat, 27 Feb 2010 23:50:54 +0800
Subject: [PATCH] ath9k: decrease size of ath9k.ko

The patch defines the fields of 'valid_single_stream' and 'valid' in
struct ath_rate_table as char type, so decrease the size of ath9k.ko
about 2KB.

old ath9k.ko
[tom@tom-lei ath9k]$ size ath9k.ko
   text    data     bss     dec     hex filename
  69344    3080     168   72592   11b90 ath9k.ko

new ath9k.ko
[tom@tom-lei ath9k]$ size ath9k.ko
   text    data     bss     dec     hex filename
  67304    3080     168   70552   11398 ath9k.ko

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---

This version takes Larry's suggestion to define 'valid_single_stream'
and 'valid' as u8 instead of char.

---
 drivers/net/wireless/ath/ath9k/rc.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
index 4f6d6fd..aeaaa88 100644
--- a/drivers/net/wireless/ath/ath9k/rc.h
+++ b/drivers/net/wireless/ath/ath9k/rc.h
@@ -110,8 +110,8 @@ struct ath_rate_table {
 	int rate_cnt;
 	int mcs_start;
 	struct {
-		int valid;
-		int valid_single_stream;
+		u8 valid;
+		u8 valid_single_stream;
 		u8 phy;
 		u32 ratekbps;
 		u32 user_ratekbps;
-- 
1.6.2.5



On Sat, 27 Feb 2010 21:19:51 -0600
Larry Finger <Larry.Finger@lwfinger.net> wrote:

> On 02/27/2010 08:52 PM, Ming Lei wrote:
> > 2010/2/28 Larry Finger <Larry.Finger@lwfinger.net>:
> >> On 02/27/2010 10:56 AM, tom.leiming@gmail.com wrote:
> >>> From: Ming Lei <tom.leiming@gmail.com>
> > 
> > Either 'char' or 'u8' is OK, since both has one-byte size, isn't it?
> 
> It wasn't the size, but the content implied by the type.


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-03-01 15:13         ` Ming Lei
  0 siblings, 0 replies; 22+ messages in thread
From: Ming Lei @ 2010-03-01 15:13 UTC (permalink / raw)
  To: ath9k-devel



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] ath9k: decrease size of ath9k.ko
  2010-03-01 15:13         ` [ath9k-devel] " Ming Lei
@ 2010-03-03  5:02           ` Pavel Roskin
  -1 siblings, 0 replies; 22+ messages in thread
From: Pavel Roskin @ 2010-03-03  5:02 UTC (permalink / raw)
  To: Ming Lei
  Cc: Larry Finger, lrodriguez, linux-wireless, ath9k-devel, linville,
	johannes

On Mon, 2010-03-01 at 23:13 +0800, Ming Lei wrote:
> -		int valid;
> -		int valid_single_stream;
> +		u8 valid;
> +		u8 valid_single_stream;

You can use bool instead, and that would give the same size saving while
being even more descriptive.  I think using bool could be safer, as the
compiler would be able to detect some misuses and the values.

But I could get even more saving by using bool with the field width:

bool valid:1;
bool valid_single_stream:1;

That would place both variables into one byte.  It may be ineffective
for speed, but it's more effective for storage.

In my configuration, I get following sizes:

original (int):    2792138
your patch (u8):   2790186
bool:              2790186
bool (1 bit):      2789218

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-03-03  5:02           ` Pavel Roskin
  0 siblings, 0 replies; 22+ messages in thread
From: Pavel Roskin @ 2010-03-03  5:02 UTC (permalink / raw)
  To: ath9k-devel

On Mon, 2010-03-01 at 23:13 +0800, Ming Lei wrote:
> -		int valid;
> -		int valid_single_stream;
> +		u8 valid;
> +		u8 valid_single_stream;

You can use bool instead, and that would give the same size saving while
being even more descriptive.  I think using bool could be safer, as the
compiler would be able to detect some misuses and the values.

But I could get even more saving by using bool with the field width:

bool valid:1;
bool valid_single_stream:1;

That would place both variables into one byte.  It may be ineffective
for speed, but it's more effective for storage.

In my configuration, I get following sizes:

original (int):    2792138
your patch (u8):   2790186
bool:              2790186
bool (1 bit):      2789218

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] ath9k: decrease size of ath9k.ko
  2010-03-03  5:02           ` [ath9k-devel] " Pavel Roskin
@ 2010-03-04  0:54             ` Luis R. Rodriguez
  -1 siblings, 0 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2010-03-04  0:54 UTC (permalink / raw)
  To: Pavel Roskin
  Cc: Ming Lei, Larry Finger, Luis Rodriguez, linux-wireless,
	ath9k-devel, linville, johannes

On Tue, Mar 02, 2010 at 09:02:44PM -0800, Pavel Roskin wrote:
> On Mon, 2010-03-01 at 23:13 +0800, Ming Lei wrote:
> > -		int valid;
> > -		int valid_single_stream;
> > +		u8 valid;
> > +		u8 valid_single_stream;
> 
> You can use bool instead, and that would give the same size saving while
> being even more descriptive.  I think using bool could be safer, as the
> compiler would be able to detect some misuses and the values.
> 
> But I could get even more saving by using bool with the field width:
> 
> bool valid:1;
> bool valid_single_stream:1;
> 
> That would place both variables into one byte.  It may be ineffective
> for speed, but it's more effective for storage.
> 
> In my configuration, I get following sizes:
> 
> original (int):    2792138
> your patch (u8):   2790186
> bool:              2790186
> bool (1 bit):      2789218

Or use flags, and use BIT(1), BIT(2), etc for #defines for each stream mode.
Would save even more.

  Luis

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-03-04  0:54             ` Luis R. Rodriguez
  0 siblings, 0 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2010-03-04  0:54 UTC (permalink / raw)
  To: ath9k-devel

On Tue, Mar 02, 2010 at 09:02:44PM -0800, Pavel Roskin wrote:
> On Mon, 2010-03-01 at 23:13 +0800, Ming Lei wrote:
> > -		int valid;
> > -		int valid_single_stream;
> > +		u8 valid;
> > +		u8 valid_single_stream;
> 
> You can use bool instead, and that would give the same size saving while
> being even more descriptive.  I think using bool could be safer, as the
> compiler would be able to detect some misuses and the values.
> 
> But I could get even more saving by using bool with the field width:
> 
> bool valid:1;
> bool valid_single_stream:1;
> 
> That would place both variables into one byte.  It may be ineffective
> for speed, but it's more effective for storage.
> 
> In my configuration, I get following sizes:
> 
> original (int):    2792138
> your patch (u8):   2790186
> bool:              2790186
> bool (1 bit):      2789218

Or use flags, and use BIT(1), BIT(2), etc for #defines for each stream mode.
Would save even more.

  Luis

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] ath9k: decrease size of ath9k.ko
  2010-03-03  5:02           ` [ath9k-devel] " Pavel Roskin
@ 2010-03-06 14:47             ` Ming Lei
  -1 siblings, 0 replies; 22+ messages in thread
From: Ming Lei @ 2010-03-06 14:47 UTC (permalink / raw)
  To: Pavel Roskin
  Cc: Larry Finger, lrodriguez, linux-wireless, ath9k-devel, linville,
	johannes

2010/3/3 Pavel Roskin <proski@gnu.org>:
> On Mon, 2010-03-01 at 23:13 +0800, Ming Lei wrote:
>> -             int valid;
>> -             int valid_single_stream;
>> +             u8 valid;
>> +             u8 valid_single_stream;
>
> You can use bool instead, and that would give the same size saving while
> being even more descriptive.  I think using bool could be safer, as the
> compiler would be able to detect some misuses and the values.
>
> But I could get even more saving by using bool with the field width:
>
> bool valid:1;
> bool valid_single_stream:1;
>
> That would place both variables into one byte.  It may be ineffective
> for speed, but it's more effective for storage.
>
> In my configuration, I get following sizes:
>
> original (int):    2792138
> your patch (u8):   2790186
> bool:              2790186
> bool (1 bit):      2789218

1bit is not enough, at least 3bit is required for each one.

We does not save more using bit field since size of the least type
is 1 byte.

-- 
Lei Ming

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-03-06 14:47             ` Ming Lei
  0 siblings, 0 replies; 22+ messages in thread
From: Ming Lei @ 2010-03-06 14:47 UTC (permalink / raw)
  To: ath9k-devel

2010/3/3 Pavel Roskin <proski@gnu.org>:
> On Mon, 2010-03-01 at 23:13 +0800, Ming Lei wrote:
>> - ? ? ? ? ? ? int valid;
>> - ? ? ? ? ? ? int valid_single_stream;
>> + ? ? ? ? ? ? u8 valid;
>> + ? ? ? ? ? ? u8 valid_single_stream;
>
> You can use bool instead, and that would give the same size saving while
> being even more descriptive. ?I think using bool could be safer, as the
> compiler would be able to detect some misuses and the values.
>
> But I could get even more saving by using bool with the field width:
>
> bool valid:1;
> bool valid_single_stream:1;
>
> That would place both variables into one byte. ?It may be ineffective
> for speed, but it's more effective for storage.
>
> In my configuration, I get following sizes:
>
> original (int): ? ?2792138
> your patch (u8): ? 2790186
> bool: ? ? ? ? ? ? ?2790186
> bool (1 bit): ? ? ?2789218

1bit is not enough, at least 3bit is required for each one.

We does not save more using bit field since size of the least type
is 1 byte.

-- 
Lei Ming

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [stable] [PATCH] ath9k: decrease size of ath9k.ko
  2010-02-27 16:56 ` [ath9k-devel] " tom.leiming at gmail.com
@ 2010-03-10 23:52   ` Greg KH
  -1 siblings, 0 replies; 22+ messages in thread
From: Greg KH @ 2010-03-10 23:52 UTC (permalink / raw)
  To: tom.leiming
  Cc: lrodriguez, ath9k-devel, linux-wireless, linville, johannes, stable

On Sun, Feb 28, 2010 at 12:56:43AM +0800, tom.leiming@gmail.com wrote:
> From: Ming Lei <tom.leiming@gmail.com>
> 
> The patch defines the fields of 'valid_single_stream' and 'valid' in
> struct ath_rate_table as char type, so decrease the size of ath9k.ko
> about 2KB.

Why would this be a -stable patch?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [stable] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-03-10 23:52   ` Greg KH
  0 siblings, 0 replies; 22+ messages in thread
From: Greg KH @ 2010-03-10 23:52 UTC (permalink / raw)
  To: ath9k-devel

On Sun, Feb 28, 2010 at 12:56:43AM +0800, tom.leiming at gmail.com wrote:
> From: Ming Lei <tom.leiming@gmail.com>
> 
> The patch defines the fields of 'valid_single_stream' and 'valid' in
> struct ath_rate_table as char type, so decrease the size of ath9k.ko
> about 2KB.

Why would this be a -stable patch?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [stable] [PATCH] ath9k: decrease size of ath9k.ko
  2010-03-10 23:52   ` [ath9k-devel] " Greg KH
@ 2010-03-11  0:42     ` Luis R. Rodriguez
  -1 siblings, 0 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2010-03-11  0:42 UTC (permalink / raw)
  To: Greg KH
  Cc: tom.leiming, Luis Rodriguez, ath9k-devel, linux-wireless,
	linville, johannes, stable

On Wed, Mar 10, 2010 at 03:52:20PM -0800, Greg KH wrote:
> On Sun, Feb 28, 2010 at 12:56:43AM +0800, tom.leiming@gmail.com wrote:
> > From: Ming Lei <tom.leiming@gmail.com>
> > 
> > The patch defines the fields of 'valid_single_stream' and 'valid' in
> > struct ath_rate_table as char type, so decrease the size of ath9k.ko
> > about 2KB.
> 
> Why would this be a -stable patch?
> 
> confused,

Its not, oh he e-mailed stable, yeah ignore.

  Luis

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [ath9k-devel] [stable] [PATCH] ath9k: decrease size of ath9k.ko
@ 2010-03-11  0:42     ` Luis R. Rodriguez
  0 siblings, 0 replies; 22+ messages in thread
From: Luis R. Rodriguez @ 2010-03-11  0:42 UTC (permalink / raw)
  To: ath9k-devel

On Wed, Mar 10, 2010 at 03:52:20PM -0800, Greg KH wrote:
> On Sun, Feb 28, 2010 at 12:56:43AM +0800, tom.leiming at gmail.com wrote:
> > From: Ming Lei <tom.leiming@gmail.com>
> > 
> > The patch defines the fields of 'valid_single_stream' and 'valid' in
> > struct ath_rate_table as char type, so decrease the size of ath9k.ko
> > about 2KB.
> 
> Why would this be a -stable patch?
> 
> confused,

Its not, oh he e-mailed stable, yeah ignore.

  Luis

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-03-11  0:43 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-27 16:56 [PATCH] ath9k: decrease size of ath9k.ko tom.leiming
2010-02-27 16:56 ` [ath9k-devel] " tom.leiming at gmail.com
2010-02-27 17:10 ` Larry Finger
2010-02-27 17:10   ` [ath9k-devel] " Larry Finger
2010-02-28  2:52   ` Ming Lei
2010-02-28  2:52     ` [ath9k-devel] " Ming Lei
2010-02-28  3:19     ` Larry Finger
2010-02-28  3:19       ` [ath9k-devel] " Larry Finger
2010-03-01 15:13       ` Ming Lei
2010-03-01 15:13         ` [ath9k-devel] " Ming Lei
2010-03-03  5:02         ` Pavel Roskin
2010-03-03  5:02           ` [ath9k-devel] " Pavel Roskin
2010-03-04  0:54           ` Luis R. Rodriguez
2010-03-04  0:54             ` [ath9k-devel] " Luis R. Rodriguez
2010-03-06 14:47           ` Ming Lei
2010-03-06 14:47             ` [ath9k-devel] " Ming Lei
2010-03-01 12:19     ` Holger Schurig
2010-03-01 12:19       ` [ath9k-devel] " Holger Schurig
2010-03-10 23:52 ` [stable] " Greg KH
2010-03-10 23:52   ` [ath9k-devel] " Greg KH
2010-03-11  0:42   ` Luis R. Rodriguez
2010-03-11  0:42     ` [ath9k-devel] " Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.