Skip to content

Commit

Permalink
Remove duplicated hwloc include
Browse files Browse the repository at this point in the history
  • Loading branch information
tlichwala committed Dec 11, 2024
1 parent e6210fb commit 9712d65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/iocore/eventsystem/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class Thread
ProxyAllocator criptContextAllocator;
#endif

#if TS_USE_HWLOC
#if TS_USE_HWLOC && TS_USE_NUMA
/**
* Set the affinity used when starting the thread.
Expand Down Expand Up @@ -181,7 +181,7 @@ class Thread

protected:
Thread();
#if TS_USE_HWLOC
#if TS_USE_HWLOC && TS_USE_NUMA
hwloc_cpuset_t cpuset = nullptr;
#endif
};
Expand Down
3 changes: 1 addition & 2 deletions include/tscore/ink_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@
#include "tscore/ink_defs.h"
#include <sched.h>
#if TS_USE_HWLOC
#include <hwloc.h>
#include "tscore/ink_hw.h"
#if USE_NUMA
#include <hwloc/glibc-sched.h>
#endif
#include "tscore/ink_hw.h"
#endif

//////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions src/iocore/eventsystem/UnixEventProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ThreadAffinityInitializer : public Continuation
/// whether HWLOC is enabled.
void *alloc_stack(EThread *t, size_t stacksize);

#if TS_USE_HWLOC
#if TS_USE_HWLOC && TS_USE_NUMA
hwloc_obj_type_t
get_obj_type()
{
Expand Down Expand Up @@ -517,7 +517,7 @@ EventProcessor::spawn_event_threads(EventType ev_type, int n_threads, size_t sta
snprintf(thr_name, MAX_THREAD_NAME_LENGTH, "[%s %d]", tg->_name.c_str(), i);
void *stack = Thread_Affinity_Initializer.alloc_stack(tg->_thread[i], stacksize);

#if TS_USE_HWLOC
#if TS_USE_HWLOC && TS_USE_NUMA
hwloc_obj_t obj = hwloc_get_obj_by_type(ink_get_topology(), Thread_Affinity_Initializer.get_obj_type(),
tg->_thread[i]->id % Thread_Affinity_Initializer.get_obj_count());
tg->_thread[i]->set_start_affinity(obj->cpuset);
Expand Down Expand Up @@ -649,7 +649,7 @@ EventProcessor::spawn_thread(Continuation *cont, const char *thr_name, size_t st
}
(void)thread_index;

#if TS_USE_HWLOC // TODO: allow configuring affinity for dthreads?
#if TS_USE_HWLOC && TS_USE_NUMA // TODO: allow configuring affinity for dthreads?
auto n_objs = hwloc_get_nbobjs_by_type(ink_get_topology(), HWLOC_OBJ_NODE);
hwloc_obj_t obj = hwloc_get_obj_by_type(ink_get_topology(), HWLOC_OBJ_NODE, thread_index % n_objs);
e->ethread->set_start_affinity(obj->cpuset);
Expand Down

0 comments on commit 9712d65

Please sign in to comment.