当usbnet打印 kevent * may have been dropped(转)

Posted erhu-67786482

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了当usbnet打印 kevent * may have been dropped(转)相关的知识,希望对你有一定的参考价值。

http://patchwork.ozlabs.org/patch/815639/

 

Every once in a while when my system is under a bit of stress I see
some spammy messages show up in my logs that say:

  kevent X may have been dropped

As far as I can tell these messages aren‘t terribly useful.  The
comments around the messages make me think that either workqueues used
to work differently or that the original author of the code missed a
sublety related to them.  The error message appears to predate the git
conversion of the kernel so it‘s somewhat hard to tell.

Specifically, workqueues should work like this:

A) If a workqueue hasn‘t been scheduled then schedule_work() schedules
   it and returns true.

B) If a workqueue has been scheduled (but hasn‘t started) then
   schedule_work() will do nothing and return false.

C) If a workqueue has been scheduled (and has started) then
   schedule_work() will put it on the queue to run again and return
   true.

Said another way: if you call schedule_work() you can guarantee that
at least one full runthrough of the work will happen again.  That
should mean that the work will get processed and I don‘t see any
reason to think something should be dropped.

Reading the comments in in usbnet_defer_kevent() made me think that B)
and C) would be treated the same.  That is: even if we‘ve started the
work and are 99% of the way through then schedule_work() would return
false and the work wouldn‘t be queued again.  If schedule_work()
really did behave that way then, truly, some amount of work would be
lost.  ...but it doesn‘t.

NOTE: if somehow these warnings are useful to mean something then
perhaps we should change them to make it more obvious.  If it‘s
interesting to know when the work is backlogged then we should change
the spam to say "warning: usbnet is backlogged".

ALSO NOTE: If somehow some of the types of work need to be repeated if
usbnet_defer_kevent() is called multiple times then that should be
quite easy to accomplish without dropping any work on the floor.  We
can just keep an atomic count for that type of work and add a loop
into usbnet_deferred_kevent().

以上是关于当usbnet打印 kevent * may have been dropped(转)的主要内容,如果未能解决你的问题,请参考以下文章

golang 程序配置文件中的 runtime.kevent 是啥?

RK3399平台开发系列讲解(USB网卡)5.47USBNET驱动模型

如何用 kevent() 替换 select() 以获得更高的性能?

Swift 3.2 - 编译器不允许我使用 Darwin.kevent 全局函数

内核事件KEVENT(同步)

RK3399平台开发系列讲解(USB网卡)5.48USBNET的CDC link on/off 消息