Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1703593

Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data

From "Huang\, Ying" <ying.huang@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data
Date 2017-08-04 04:10 +0200
Message-ID <uaAdP-wl-1@gated-at.bofh.it> (permalink)
References (1 earlier) <u9XFv-7As-3@gated-at.bofh.it> <u9YUX-7q-29@gated-at.bofh.it> <uajPH-5RD-1@gated-at.bofh.it> <uak94-5ZO-31@gated-at.bofh.it> <uazB7-8qU-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


"Huang, Ying" <ying.huang@intel.com> writes:

> Peter Zijlstra <peterz@infradead.org> writes:
> [snip]
>> diff --git a/include/linux/smp.h b/include/linux/smp.h
>> index 68123c1fe549..8d817cb80a38 100644
>> --- a/include/linux/smp.h
>> +++ b/include/linux/smp.h
>> @@ -14,13 +14,16 @@
>>  #include <linux/llist.h>
>>  
>>  typedef void (*smp_call_func_t)(void *info);
>> -struct call_single_data {
>> +struct __call_single_data {
>>  	struct llist_node llist;
>>  	smp_call_func_t func;
>>  	void *info;
>>  	unsigned int flags;
>>  };
>>  
>> +typedef struct __call_single_data call_single_data_t
>> +	__aligned(sizeof(struct __call_single_data));
>> +
>
> Another requirement of the alignment is that it should be the power of
> 2.  Otherwise, for example, if someone adds a field to struct, so that
> the size becomes 40 on x86_64.  The alignment should be 64 instead of
> 40.

Thanks Aaron, he reminded me that there is a roundup_pow_of_two().  So
the typedef could be,

typedef struct __call_single_data call_single_data_t
	__aligned(roundup_pow_of_two(sizeof(struct __call_single_data));

Best Regards,
Huang, Ying

> Best Regards,
> Huang, Ying
>
>>  /* total number of cpus in this system (may exceed NR_CPUS) */
>>  extern unsigned int total_cpus;
>>  
> [snip]

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data "Huang, Ying" <ying.huang@intel.com> - 2017-08-02 11:00 +0200
  Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one  call_single_data Eric Dumazet <eric.dumazet@gmail.com> - 2017-08-02 12:20 +0200
    Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one  call_single_data Peter Zijlstra <peterz@infradead.org> - 2017-08-02 13:00 +0200
    Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data "Huang\, Ying" <ying.huang@intel.com> - 2017-08-03 10:40 +0200
      Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one  call_single_data Peter Zijlstra <peterz@infradead.org> - 2017-08-03 11:00 +0200
        Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data "Huang\, Ying" <ying.huang@intel.com> - 2017-08-04 03:30 +0200
          Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data "Huang\, Ying" <ying.huang@intel.com> - 2017-08-04 04:10 +0200
            Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one  call_single_data Peter Zijlstra <peterz@infradead.org> - 2017-08-04 11:30 +0200
              Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data "Huang\, Ying" <ying.huang@intel.com> - 2017-08-05 02:50 +0200
                Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one  call_single_data Peter Zijlstra <peterz@infradead.org> - 2017-08-07 10:30 +0200
                Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one call_single_data "Huang\, Ying" <ying.huang@intel.com> - 2017-08-08 06:40 +0200
          Re: [PATCH 3/3] IPI: Avoid to use 2 cache lines for one  call_single_data Peter Zijlstra <peterz@infradead.org> - 2017-08-04 11:30 +0200

csiph-web