On Thu, Sep 02, 2021 at 09:13:24PM +0200, Thomas Gleixner wrote: > > I'm only throwing this out as a reaction to this - I'm not sure > > another interface would be good or worthwhile, but that "enum > > cpuhp_state" is ugly enough that I thought I'd rope in Thomas for CPU > > hotplug, and the percpu memory allocation people for comments. > > It's not only about memory. > > > IOW, just _maybe_ we would want to have some kind of callback model > > for "percpu_alloc()" and it being explicitly about allocations > > becoming available or going away, rather than about CPU state. > > The per cpu storage in XFS does not go away. It contains a llist head > and the queued work items need to be moved from the dead CPU to an alive > CPU and exposed to a work queue for processing. Similar to what we do > with timers, hrtimers and other stuff. > > If there are callbacks which are doing pretty much the same thing, then > I'm all for a generic infrastructure for these. In the block layer we've added a new per-cpu bio list, for which the dead callback literally does nothing but free some memory. For that case a simple callback would be neat, but I'm not sure how common that is.