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);
299
299
static inline void xdp_do_check_flushed (struct napi_struct * napi ) { }
300
300
#endif
301
301
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
+
302
314
void kick_defer_list_purge (struct softnet_data * sd , unsigned int cpu );
303
315
304
316
#define XMIT_RECURSION_LIMIT 8
Original file line number Diff line number Diff line change 26
26
27
27
#include <trace/events/page_pool.h>
28
28
29
+ #include "dev.h"
29
30
#include "mp_dmabuf_devmem.h"
30
31
#include "netmem_priv.h"
31
32
#include "page_pool_priv.h"
@@ -1147,11 +1148,7 @@ void page_pool_disable_direct_recycling(struct page_pool *pool)
1147
1148
if (!pool -> p .napi )
1148
1149
return ;
1149
1150
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 );
1155
1152
1156
1153
mutex_lock (& page_pools_lock );
1157
1154
WRITE_ONCE (pool -> p .napi , NULL );
You can’t perform that action at this time.
0 commit comments