On Sun, Oct 04, 2020 at 01:13:29PM +0100, Matthew Wilcox wrote: > Have you considered just storing a pointer to each struct file in an > epoll set in an XArray? Linked lists suck for modern CPUs, and there'd > be no need to store any additional data in each struct file. Using > xa_alloc() to store the pointer and throw away the index the pointer > got stored at would leave you with something approximating a singly > linked list, except it's an array. Which does zero memory allocations > for a single entry and will then allocate a single node for your first > 64 entries. Won't work - those struct file can get freed while we are collecting the set/allocating epitem/calling ->poll()/etc.