Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320821
b: refs/heads/master
c: 907aed4
h: refs/heads/master
i:
  320819: bcc2536
v: v3
  • Loading branch information
Mel Gorman authored and Linus Torvalds committed Aug 1, 2012
1 parent 1487116 commit 943c943
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 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: b37f1dd0f543d9714f96c2f9b9f74f7bdfdfdf31
refs/heads/master: 907aed48f65efeecf91575397e3d79335d93a466
7 changes: 7 additions & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,13 @@ static inline void rcu_copy_process(struct task_struct *p)

#endif

static inline void tsk_restore_flags(struct task_struct *task,
unsigned long orig_flags, unsigned long flags)
{
task->flags &= ~flags;
task->flags |= orig_flags & flags;
}

#ifdef CONFIG_SMP
extern void do_set_cpus_allowed(struct task_struct *p,
const struct cpumask *new_mask);
Expand Down
9 changes: 9 additions & 0 deletions trunk/kernel/softirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ asmlinkage void __do_softirq(void)
__u32 pending;
int max_restart = MAX_SOFTIRQ_RESTART;
int cpu;
unsigned long old_flags = current->flags;

/*
* Mask out PF_MEMALLOC s current task context is borrowed for the
* softirq. A softirq handled such as network RX might set PF_MEMALLOC
* again if the socket is related to swap
*/
current->flags &= ~PF_MEMALLOC;

pending = local_softirq_pending();
account_system_vtime(current);
Expand Down Expand Up @@ -265,6 +273,7 @@ asmlinkage void __do_softirq(void)

account_system_vtime(current);
__local_bh_enable(SOFTIRQ_OFFSET);
tsk_restore_flags(current, old_flags, PF_MEMALLOC);
}

#ifndef __ARCH_HAS_DO_SOFTIRQ
Expand Down
6 changes: 5 additions & 1 deletion trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,11 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
if (likely(!(gfp_mask & __GFP_NOMEMALLOC))) {
if (gfp_mask & __GFP_MEMALLOC)
alloc_flags |= ALLOC_NO_WATERMARKS;
else if (likely(!(gfp_mask & __GFP_NOMEMALLOC)) && !in_interrupt())
else if (in_serving_softirq() && (current->flags & PF_MEMALLOC))
alloc_flags |= ALLOC_NO_WATERMARKS;
else if (!in_interrupt() &&
((current->flags & PF_MEMALLOC) ||
unlikely(test_thread_flag(TIF_MEMDIE))))
alloc_flags |= ALLOC_NO_WATERMARKS;
}

Expand Down

0 comments on commit 943c943

Please sign in to comment.