Add an object to the topology.
Insert new object obj
in the topology starting under existing object root
(if NULL
, the topology root object is used).
It is sorted along the tree of other objects according to the inclusion of cpusets, to eventually be added as a child of the smallest object including this object.
If the cpuset is empty, the type of the object (and maybe some attributes) must be enough to find where to insert the object. This is especially true for NUMA nodes with memory and no CPUs.
The given object should not have children.
This shall only be called before levels are built.
The caller should check whether the object type is filtered-out before calling this function.
The topology cpuset/nodesets will be enlarged to include the object sets.
reason
is a unique string identifying where and why this insertion call was performed (it will be displayed in case of internal insertion error).
Returns the object on success. Returns NULL and frees obj on error. Returns another object and frees obj if it was merged with an identical pre-existing object.