WorkStruct: Separate delayable and non-delayable events.
Separate delayable work items from non-delayable work items be splitting them into a separate structure (delayed_work), which incorporates a work_struct and the timer_list removed from work_struct. The work_struct struct is huge, and this limits it's usefulness. On a 64-bit architecture it's nearly 100 bytes in size. This reduces that by half for the non-delayable type of event. Signed-Off-By: David Howells <dhowells@redhat.com>
This commit is contained in:
@ -35,7 +35,7 @@ static unsigned long linkwatch_flags;
|
||||
static unsigned long linkwatch_nextevent;
|
||||
|
||||
static void linkwatch_event(void *dummy);
|
||||
static DECLARE_WORK(linkwatch_work, linkwatch_event, NULL);
|
||||
static DECLARE_DELAYED_WORK(linkwatch_work, linkwatch_event, NULL);
|
||||
|
||||
static LIST_HEAD(lweventlist);
|
||||
static DEFINE_SPINLOCK(lweventlist_lock);
|
||||
@ -171,10 +171,9 @@ void linkwatch_fire_event(struct net_device *dev)
|
||||
unsigned long delay = linkwatch_nextevent - jiffies;
|
||||
|
||||
/* If we wrap around we'll delay it by at most HZ. */
|
||||
if (!delay || delay > HZ)
|
||||
schedule_work(&linkwatch_work);
|
||||
else
|
||||
schedule_delayed_work(&linkwatch_work, delay);
|
||||
if (delay > HZ)
|
||||
delay = 0;
|
||||
schedule_delayed_work(&linkwatch_work, delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user