On Mon, Mar 22, 2021 at 06:41:30PM +0100, Antoine Tenart wrote:
Quoting Matthew Wilcox (2021-03-22 17:54:39)
quoted
- rcu_read_lock();
- dev_maps = rcu_dereference(dev->xps_maps[type]);
+ dev_maps = READ_ONCE(dev->xps_maps[type]);
Couldn't dev_maps be freed between here and the read of dev_maps->nr_ids
as we're not in an RCU read-side critical section?
Oh, good point. Never mind, then.
My feeling is there is not much value in having a tricky allocation
logic for reads from xps_cpus and xps_rxqs. While we could come up with
something, returning -ENOMEM on memory pressure should be fine.
That's fine. It's your code, and this is probably a small allocation
anyway.