Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169026
b: refs/heads/master
c: fa1dae4
h: refs/heads/master
v: v3
  • Loading branch information
David Howells authored and Linus Torvalds committed Dec 1, 2009
1 parent 5c564a0 commit 4918cee
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6f054164322bc6c1233402b9ed6b40d4af39a98f
refs/heads/master: fa1dae4906982b5d896c07613b1fe42456133b1c
46 changes: 29 additions & 17 deletions trunk/kernel/slow-work.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,30 @@ static struct module *slow_work_unreg_module;
static struct slow_work *slow_work_unreg_work_item;
static DECLARE_WAIT_QUEUE_HEAD(slow_work_unreg_wq);
static DEFINE_MUTEX(slow_work_unreg_sync_lock);

static void slow_work_set_thread_processing(int id, struct slow_work *work)
{
if (work)
slow_work_thread_processing[id] = work->owner;
}
static void slow_work_done_thread_processing(int id, struct slow_work *work)
{
struct module *module = slow_work_thread_processing[id];

slow_work_thread_processing[id] = NULL;
smp_mb();
if (slow_work_unreg_work_item == work ||
slow_work_unreg_module == module)
wake_up_all(&slow_work_unreg_wq);
}
static void slow_work_clear_thread_processing(int id)
{
slow_work_thread_processing[id] = NULL;
}
#else
static void slow_work_set_thread_processing(int id, struct slow_work *work) {}
static void slow_work_done_thread_processing(int id, struct slow_work *work) {}
static void slow_work_clear_thread_processing(int id) {}
#endif

/*
Expand Down Expand Up @@ -197,9 +221,6 @@ static unsigned slow_work_calc_vsmax(void)
*/
static noinline bool slow_work_execute(int id)
{
#ifdef CONFIG_MODULES
struct module *module;
#endif
struct slow_work *work = NULL;
unsigned vsmax;
bool very_slow;
Expand Down Expand Up @@ -236,10 +257,7 @@ static noinline bool slow_work_execute(int id)
very_slow = false; /* avoid the compiler warning */
}

#ifdef CONFIG_MODULES
if (work)
slow_work_thread_processing[id] = work->owner;
#endif
slow_work_set_thread_processing(id, work);
if (work) {
slow_work_mark_time(work);
slow_work_begin_exec(id, work);
Expand Down Expand Up @@ -287,15 +305,7 @@ static noinline bool slow_work_execute(int id)

/* sort out the race between module unloading and put_ref() */
slow_work_put_ref(work);

#ifdef CONFIG_MODULES
module = slow_work_thread_processing[id];
slow_work_thread_processing[id] = NULL;
smp_mb();
if (slow_work_unreg_work_item == work ||
slow_work_unreg_module == module)
wake_up_all(&slow_work_unreg_wq);
#endif
slow_work_done_thread_processing(id, work);

return true;

Expand All @@ -310,7 +320,7 @@ static noinline bool slow_work_execute(int id)
else
list_add_tail(&work->link, &slow_work_queue);
spin_unlock_irq(&slow_work_queue_lock);
slow_work_thread_processing[id] = NULL;
slow_work_clear_thread_processing(id);
return true;
}

Expand Down Expand Up @@ -943,6 +953,7 @@ EXPORT_SYMBOL(slow_work_register_user);
*/
static void slow_work_wait_for_items(struct module *module)
{
#ifdef CONFIG_MODULES
DECLARE_WAITQUEUE(myself, current);
struct slow_work *work;
int loop;
Expand Down Expand Up @@ -989,6 +1000,7 @@ static void slow_work_wait_for_items(struct module *module)

remove_wait_queue(&slow_work_unreg_wq, &myself);
mutex_unlock(&slow_work_unreg_sync_lock);
#endif /* CONFIG_MODULES */
}

/**
Expand Down

0 comments on commit 4918cee

Please sign in to comment.