~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to mm/oom_kill.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
int sysctl_oom_dump_tasks = 1;
39
39
static DEFINE_SPINLOCK(zone_scan_lock);
40
40
 
 
41
/**
 
42
 * test_set_oom_score_adj() - set current's oom_score_adj and return old value
 
43
 * @new_val: new oom_score_adj value
 
44
 *
 
45
 * Sets the oom_score_adj value for current to @new_val with proper
 
46
 * synchronization and returns the old value.  Usually used to temporarily
 
47
 * set a value, save the old value in the caller, and then reinstate it later.
 
48
 */
 
49
int test_set_oom_score_adj(int new_val)
 
50
{
 
51
        struct sighand_struct *sighand = current->sighand;
 
52
        int old_val;
 
53
 
 
54
        spin_lock_irq(&sighand->siglock);
 
55
        old_val = current->signal->oom_score_adj;
 
56
        if (new_val != old_val) {
 
57
                if (new_val == OOM_SCORE_ADJ_MIN)
 
58
                        atomic_inc(&current->mm->oom_disable_count);
 
59
                else if (old_val == OOM_SCORE_ADJ_MIN)
 
60
                        atomic_dec(&current->mm->oom_disable_count);
 
61
                current->signal->oom_score_adj = new_val;
 
62
        }
 
63
        spin_unlock_irq(&sighand->siglock);
 
64
 
 
65
        return old_val;
 
66
}
 
67
 
41
68
#ifdef CONFIG_NUMA
42
69
/**
43
70
 * has_intersects_mems_allowed() - check task eligiblity for kill
155
182
        }
156
183
 
157
184
        /*
158
 
         * When the PF_OOM_ORIGIN bit is set, it indicates the task should have
159
 
         * priority for oom killing.
160
 
         */
161
 
        if (p->flags & PF_OOM_ORIGIN) {
162
 
                task_unlock(p);
163
 
                return 1000;
164
 
        }
165
 
 
166
 
        /*
167
185
         * The memory controller may have a limit of 0 bytes, so avoid a divide
168
186
         * by zero, if necessary.
169
187
         */
285
303
        do_each_thread(g, p) {
286
304
                unsigned int points;
287
305
 
288
 
                if (!p->mm)
 
306
                if (p->exit_state)
289
307
                        continue;
290
308
                if (oom_unkillable_task(p, mem, nodemask))
291
309
                        continue;
301
319
                 */
302
320
                if (test_tsk_thread_flag(p, TIF_MEMDIE))
303
321
                        return ERR_PTR(-1UL);
 
322
                if (!p->mm)
 
323
                        continue;
304
324
 
305
325
                if (p->flags & PF_EXITING) {
306
326
                        /*