From 5f5c4518b1bb2a6bce721b9761d3c111a7e6deef Mon Sep 17 00:00:00 2001 From: Alan Jowett Date: Fri, 22 Nov 2024 16:55:59 -0800 Subject: [PATCH] Speedup walking the free-list (#4036) * Speedup walking the free-list Signed-off-by: Alan Jowett * Switch to higher level abstraction for prefetch Signed-off-by: Alan Jowett --------- Signed-off-by: Alan Jowett Co-authored-by: Alan Jowett --- libs/runtime/ebpf_epoch.c | 1 + libs/runtime/ebpf_hash_table.c | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/runtime/ebpf_epoch.c b/libs/runtime/ebpf_epoch.c index e362327f90..ef0e69c369 100644 --- a/libs/runtime/ebpf_epoch.c +++ b/libs/runtime/ebpf_epoch.c @@ -613,6 +613,7 @@ _ebpf_epoch_release_free_list(_Inout_ ebpf_epoch_cpu_entry_t* cpu_entry, int64_t header = CONTAINING_RECORD(entry, ebpf_epoch_allocation_header_t, list_entry); if (header->freed_epoch <= released_epoch) { ebpf_list_remove_entry(entry); + PrefetchForWrite(entry->Flink->Flink); switch (header->entry_type) { case EBPF_EPOCH_ALLOCATION_MEMORY: ebpf_free(header); diff --git a/libs/runtime/ebpf_hash_table.c b/libs/runtime/ebpf_hash_table.c index 710f53b050..b7fdd27d87 100644 --- a/libs/runtime/ebpf_hash_table.c +++ b/libs/runtime/ebpf_hash_table.c @@ -828,10 +828,7 @@ ebpf_hash_table_find(_In_ const ebpf_hash_table_t* hash_table, _In_ const uint8_ goto Done; } -#if defined(_M_X64) - // Prefetch the data on the assumption that it will be used by the caller soon. - _mm_prefetch((const char*)data, _MM_HINT_T0); -#endif + PrefetchForWrite(data); *value = data; if (hash_table->notification_callback) {