summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/epoll/epoll_state.go
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-03-25 11:40:49 -0700
committerShentubot <shentubot@google.com>2019-03-25 11:41:50 -0700
commitddc05e3053e387be9c81aa98c621b6fc92b01000 (patch)
tree405eb7901958aec9a73d32eac1f58c2536e4f9cc /pkg/sentry/kernel/epoll/epoll_state.go
parentb81bfd6013ce871524e493272ac36b134f7fbbdf (diff)
epoll: use ilist:generic_list instead of ilist:ilist
ilist:generic_list works faster than ilist:ilist. Here is a beanchmark test to measure performance of epoll_wait, when readyList isn't empty. It shows about 30% better performance with these changes. Benchmark Time(ns) CPU(ns) Iterations Before: BM_EpollAllEvents 46725 46899 14286 After: BM_EpollAllEvents 33167 33300 18919 PiperOrigin-RevId: 240185278 Change-Id: I3e33f9b214db13ab840b91613400525de5b58d18
Diffstat (limited to 'pkg/sentry/kernel/epoll/epoll_state.go')
-rw-r--r--pkg/sentry/kernel/epoll/epoll_state.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/pkg/sentry/kernel/epoll/epoll_state.go b/pkg/sentry/kernel/epoll/epoll_state.go
index 7f3e2004a..f6e3e4825 100644
--- a/pkg/sentry/kernel/epoll/epoll_state.go
+++ b/pkg/sentry/kernel/epoll/epoll_state.go
@@ -15,7 +15,6 @@
package epoll
import (
- "gvisor.googlesource.com/gvisor/pkg/ilist"
"gvisor.googlesource.com/gvisor/pkg/refs"
"gvisor.googlesource.com/gvisor/pkg/waiter"
)
@@ -33,18 +32,17 @@ func (e *EventPoll) afterLoad() {
e.listsMu.Lock()
defer e.listsMu.Unlock()
- for _, ls := range []*ilist.List{&e.waitingList, &e.readyList, &e.disabledList} {
+ for _, ls := range []*pollEntryList{&e.waitingList, &e.readyList, &e.disabledList} {
for it := ls.Front(); it != nil; it = it.Next() {
- it.(*pollEntry).curList = ls
+ it.curList = ls
}
}
for it := e.waitingList.Front(); it != nil; it = it.Next() {
- p := it.(*pollEntry)
- if p.id.File.Readiness(p.mask) != 0 {
- e.waitingList.Remove(p)
- e.readyList.PushBack(p)
- p.curList = &e.readyList
+ if it.id.File.Readiness(it.mask) != 0 {
+ e.waitingList.Remove(it)
+ e.readyList.PushBack(it)
+ it.curList = &e.readyList
e.Notify(waiter.EventIn)
}
}