Skip to content

Commit 444d682

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: optimize sdw_stream_runtime memory layout
pahole suggestion: swap position of 'm_rt_count' before: pahole -C sdw_stream_runtime drivers/soundwire/soundwire-bus.ko struct sdw_stream_runtime { const char * name; /* 0 8 */ struct sdw_stream_params params; /* 8 12 */ enum sdw_stream_state state; /* 20 4 */ enum sdw_stream_type type; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ struct list_head master_list; /* 32 16 */ int m_rt_count; /* 48 4 */ /* size: 56, cachelines: 1, members: 6 */ /* sum members: 48, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 56 bytes */ }; after: pahole --reorganize -C sdw_stream_runtime drivers/soundwire/soundwire-bus.ko struct sdw_stream_runtime { const char * name; /* 0 8 */ struct sdw_stream_params params; /* 8 12 */ enum sdw_stream_state state; /* 20 4 */ enum sdw_stream_type type; /* 24 4 */ int m_rt_count; /* 28 4 */ struct list_head master_list; /* 32 16 */ /* size: 48, cachelines: 1, members: 6 */ /* last cacheline: 48 bytes */ }; /* saved 8 bytes! */ Signed-off-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 093227b commit 444d682

File tree

1 file changed

+5
-5
lines changed
  • include/linux/soundwire

1 file changed

+5
-5
lines changed

include/linux/soundwire/sdw.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -820,15 +820,15 @@ struct sdw_master_port_ops {
820820
struct sdw_msg;
821821

822822
/**
823-
* struct sdw_defer - SDW deffered message
824-
* @length: message length
823+
* struct sdw_defer - SDW deferred message
825824
* @complete: message completion
826825
* @msg: SDW message
826+
* @length: message length
827827
*/
828828
struct sdw_defer {
829+
struct sdw_msg *msg;
829830
int length;
830831
struct completion complete;
831-
struct sdw_msg *msg;
832832
};
833833

834834
/**
@@ -1010,18 +1010,18 @@ struct sdw_stream_params {
10101010
* @params: Stream parameters
10111011
* @state: Current state of the stream
10121012
* @type: Stream type PCM or PDM
1013+
* @m_rt_count: Count of Master runtime(s) in this stream
10131014
* @master_list: List of Master runtime(s) in this stream.
10141015
* master_list can contain only one m_rt per Master instance
10151016
* for a stream
1016-
* @m_rt_count: Count of Master runtime(s) in this stream
10171017
*/
10181018
struct sdw_stream_runtime {
10191019
const char *name;
10201020
struct sdw_stream_params params;
10211021
enum sdw_stream_state state;
10221022
enum sdw_stream_type type;
1023-
struct list_head master_list;
10241023
int m_rt_count;
1024+
struct list_head master_list;
10251025
};
10261026

10271027
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name);

0 commit comments

Comments
 (0)