[ovs-dev] [PATCH RFC 1/5] compiler: Introduce OVS_PREFETCH variants.
Bodireddy, Bhanuprakash
bhanuprakash.bodireddy at intel.com
Mon Dec 4 20:43:03 UTC 2017
Hi Ben,
>On Mon, Dec 04, 2017 at 08:16:46PM +0000, Bhanuprakash Bodireddy wrote:
>> This commit introduces prefetch variants by using the GCC built-in
>> prefetch function.
>>
>> The prefetch variants gives the user better control on designing data
>> caching strategy in order to increase cache efficiency and minimize
>> cache pollution. Data reference patterns here can be classified in to
>>
>> - Non-temporal(NT) - Data that is referenced once and not reused in
>> immediate future.
>> - Temporal - Data will be used again soon.
>>
>> The Macro variants can be used where there are
>> - Predictable memory access patterns.
>> - Execution pipeline can stall if data isn't available.
>> - Time consuming loops.
>>
>> For example:
>>
>> OVS_PREFETCH_CACHE(addr, OPCH_LTR)
>> - OPCH_LTR : OVS PREFETCH CACHE HINT-LOW TEMPORAL READ.
>> - __builtin_prefetch(addr, 0, 1)
>> - Prefetch data in to L3 cache for readonly purpose.
>>
>> OVS_PREFETCH_CACHE(addr, OPCH_HTW)
>> - OPCH_HTW : OVS PREFETCH CACHE HINT-HIGH TEMPORAL WRITE.
>> - __builtin_prefetch(addr, 1, 3)
>> - Prefetch data in to all caches in anticipation of write. In doing
>> so it invalidates other cached copies so as to gain 'exclusive'
>> access.
>>
>> OVS_PREFETCH(addr)
>> - OPCH_HTR : OVS PREFETCH CACHE HINT-HIGH TEMPORAL READ.
>> - __builtin_prefetch(addr, 0, 3)
>> - Prefetch data in to all caches in anticipation of read and that
>> data will be used again soon (HTR - High Temporal Read).
>>
>> Signed-off-by: Bhanuprakash Bodireddy
>> <bhanuprakash.bodireddy at intel.com>
>
>The information in this commit message seems like it could also be useful as
>part of a code comment.
This makes sense and I can include this in the code comments with some examples of usage.
- Bhanuprakash.
More information about the dev
mailing list