The task structure, the root data structure containing several dozen thread attributes, has a few attributes directly pertaining to scheduling: the priority (the nice as well as the RT priority values), the scheduling class structure pointer, the runqueue the thread is on (if any), and so on.
Among these is an important member, the CPU affinity bitmask (the actual structure member is cpumask_t cpus_allowed). This also tells you that the CPU affinity bitmask is a per-thread quantity; this makes sense - the KSE on Linux is a thread, after all. It's essentially an array of bits, each bit representing a CPU core (with sufficient bits available within the variable); if the bit corresponding to a core is set (1), the thread is allowed to be scheduled on and execute on that core; if cleared (0), it's not.
By default, all the CPU affinity mask bits are set; thus, the thread can run on any core....