Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2035 closed Enhancement (fixed)

Transmission causes wakeups by unnecessary polling.

Reported by: charles Owned by: charles
Priority: Normal Milestone: 1.70
Component: libtransmission Version: 1.60
Severity: Minor Keywords:
Cc:

Description (last modified by charles)

Downstream ticket: https://bugzilla.redhat.com/show_bug.cgi?id=486111

I installed F11 Beta (in a virtual machine) and updated transmission to 1.51-2
(latest Rawhide).  Powertop now reports 3-4 wake ups per second: 

14.7% (  3.5)      transmission : __mod_timer (process_timeout)
 2.1% (  0.5)      transmission : schedule_hrtimeout_range (hrtimer_wakeup)

Rawhide strace attached (strace transmission -m 2> rawhide-strace.out C-c after
~30 seconds).  

We're never going to get to zero wakeups, but there is some low-hanging fruit:

  • the bound socket(s) that listen for incoming peers should use libevent to know when to accept() peers, rather than polling once per second.
  • there are a couple of twice-per-second timers in peer-mgr.c that can be folded into the same timer
  • the tracker timer, which fires once per second, can at a minimum be modified to fire less frequently. Some of this will be moot after #1699 but a longer interval would be a good interim step.

Attachments (3)

timers.diff (3.0 KB) - added by charles 12 years ago.
patch to defer timer creation until a torrent is started
tracker.diff (418 bytes) - added by charles 12 years ago.
simple one-liner to increase the tracker pulse interval from 1 sec to 1.5 sec
net.diff (33.6 KB) - added by charles 12 years ago.
(1) use libevent to know when to accept() incoming peers. (2) kill the port forwarding timer except for when it's needed.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 12 years ago by charles

  • Owner set to charles
  • Status changed from new to assigned

comment:2 Changed 12 years ago by charles

  • Component changed from Transmission to libtransmission

Changed 12 years ago by charles

patch to defer timer creation until a torrent is started

comment:3 Changed 12 years ago by charles

  • Description modified (diff)
  • Milestone changed from None Set to 1.70
  • Type changed from Bug to Enhancement

Changed 12 years ago by charles

simple one-liner to increase the tracker pulse interval from 1 sec to 1.5 sec

comment:4 Changed 12 years ago by charles

  • Milestone changed from 1.70 to 1.62

comment:5 Changed 12 years ago by charles

  • Milestone changed from 1.62 to 1.70

Those two diffs have been committed in r8394

comment:6 Changed 12 years ago by charles

better:

[root@localhost gtk]# powertop --dump 2>&1 | grep " transmission : "
   0.1% (  2.1)      transmission : __mod_timer (process_timeout) 
   0.0% (  0.5)      transmission : hrtimer_start_range_ns (hrtimer_wakeup) 

comment:7 Changed 12 years ago by charles

and even better, with the net.diff patch:

[root@localhost charles]# powertop --dump 2>&1 | grep " transmission : "
   0.5% (  0.9)      transmission : __mod_timer (process_timeout) 
   0.3% (  0.5)      transmission : hrtimer_start_range_ns (hrtimer_wakeup) 
   0.0% (  0.1)      transmission : __mod_timer (death_by_timeout) 

Realistically speaking, this is about as low as we're going to get unless someone else feels strongly enough about this to dig in and hack some more. I think we're reaching the point of diminishing returns wrt code complexity vs. wakeups.

Changed 12 years ago by charles

(1) use libevent to know when to accept() incoming peers. (2) kill the port forwarding timer except for when it's needed.

comment:8 Changed 12 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

net.diff committed in r8398

comment:9 Changed 12 years ago by charles

  • Milestone changed from 1.70 to 1.62

comment:10 Changed 12 years ago by charles

  • Milestone changed from 1.62 to 1.70

Bumping back to 1.70.

The changes in net.diff are convoluted enough that I'd rather not do them in a bugfix release.

Note: See TracTickets for help on using tickets.