On Thu, Feb 7, 2019 at 12:10 AM Keith Busch <keith.busch@xxxxxxxxx> wrote: > > On Tue, Feb 05, 2019 at 04:17:09PM +0100, Rafael J. Wysocki wrote: > > <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > > > > > > When you use a "raw" kobject then userspace tools do not see the devices > > > and attributes in libraries like udev. > > > > And why would they need it in this particular case? > > > > > So unless userspace does not care about this at all, > > > > Which I think is the case here, isn't it? > > > > > you should use a 'struct device' where ever > > > possible. The memory "savings" usually just isn't worth it unless you > > > have a _lot_ of objects being created here. > > > > > > Who is going to use all of this new information? > > > > Somebody who wants to know how the memory in the system is laid out AFAICS. > > Yes, this is for user space to make informed decisions about where it > wants to allocate/relocate hot and cold data with respect to particular > compute domains. So user space should care about these attributes, > and they won't always be static when memory hotplug support for these > attributes is added. > > Does that change anything, or still recommending kobject? I don't have a > strong opinion either way and have both options coded and ready to > submit new version once I know which direction is most acceptable. If you want to make dynamic changes to the sysfs directories under this object, uevents generated by device registration and unregstration may be useful. However, they only trigger automatically when you register and unregister, so presumably you'd need to do that every time for the changes to trigger an update in user space. Also, whoever is interested in this data would need to listen to the uevents to get notified. OTOH, you can call kobject_uevent() for the "raw" kobjects too. Anyway, if Greg really prefers struct device to be used here, that's fine by me, but since the uevents in question are going to be part of your user space I/F then, it may be good to take that into consideration. :-) After all, you need to know how you want the I/F to work.