File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,18 @@ void xdp_do_check_flushed(struct napi_struct *napi);
299299static inline void xdp_do_check_flushed (struct napi_struct * napi ) { }
300300#endif
301301
302+ /* Best effort check that NAPI is not idle (can't be scheduled to run) */
303+ static inline void napi_assert_will_not_race (const struct napi_struct * napi )
304+ {
305+ /* uninitialized instance, can't race */
306+ if (!napi -> poll_list .next )
307+ return ;
308+
309+ /* SCHED bit is set on disabled instances */
310+ WARN_ON (!test_bit (NAPI_STATE_SCHED , & napi -> state ));
311+ WARN_ON (READ_ONCE (napi -> list_owner ) != -1 );
312+ }
313+
302314void kick_defer_list_purge (struct softnet_data * sd , unsigned int cpu );
303315
304316#define XMIT_RECURSION_LIMIT 8
Original file line number Diff line number Diff line change 2626
2727#include <trace/events/page_pool.h>
2828
29+ #include "dev.h"
2930#include "mp_dmabuf_devmem.h"
3031#include "netmem_priv.h"
3132#include "page_pool_priv.h"
@@ -1147,11 +1148,7 @@ void page_pool_disable_direct_recycling(struct page_pool *pool)
11471148 if (!pool -> p .napi )
11481149 return ;
11491150
1150- /* To avoid races with recycling and additional barriers make sure
1151- * pool and NAPI are unlinked when NAPI is disabled.
1152- */
1153- WARN_ON (!test_bit (NAPI_STATE_SCHED , & pool -> p .napi -> state ));
1154- WARN_ON (READ_ONCE (pool -> p .napi -> list_owner ) != -1 );
1151+ napi_assert_will_not_race (pool -> p .napi );
11551152
11561153 mutex_lock (& page_pools_lock );
11571154 WRITE_ONCE (pool -> p .napi , NULL );
You can’t perform that action at this time.
0 commit comments