Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 126246
b: refs/heads/master
c: 4779280
h: refs/heads/master
v: v3
  • Loading branch information
Ying Han authored and Linus Torvalds committed Jan 6, 2009
1 parent 8b98c58 commit d9c336c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 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: 91bf189c3a766927694ce9de7d545e96b23f20fc
refs/heads/master: 4779280d1ea4d361af13ae77ba55217fbcd16d4c
1 change: 1 addition & 0 deletions trunk/mm/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,
#define GUP_FLAGS_WRITE 0x1
#define GUP_FLAGS_FORCE 0x2
#define GUP_FLAGS_IGNORE_VMA_PERMISSIONS 0x4
#define GUP_FLAGS_IGNORE_SIGKILL 0x8

int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, int len, int flags,
Expand Down
14 changes: 9 additions & 5 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
int write = !!(flags & GUP_FLAGS_WRITE);
int force = !!(flags & GUP_FLAGS_FORCE);
int ignore = !!(flags & GUP_FLAGS_IGNORE_VMA_PERMISSIONS);
int ignore_sigkill = !!(flags & GUP_FLAGS_IGNORE_SIGKILL);

if (len <= 0)
return 0;
Expand Down Expand Up @@ -1288,12 +1289,15 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
struct page *page;

/*
* If tsk is ooming, cut off its access to large memory
* allocations. It has a pending SIGKILL, but it can't
* be processed until returning to user space.
* If we have a pending SIGKILL, don't keep faulting
* pages and potentially allocating memory, unless
* current is handling munlock--e.g., on exit. In
* that case, we are not allocating memory. Rather,
* we're only unlocking already resident/mapped pages.
*/
if (unlikely(test_tsk_thread_flag(tsk, TIF_MEMDIE)))
return i ? i : -ENOMEM;
if (unlikely(!ignore_sigkill &&
fatal_signal_pending(current)))
return i ? i : -ERESTARTSYS;

if (write)
foll_flags |= FOLL_WRITE;
Expand Down
9 changes: 5 additions & 4 deletions trunk/mm/mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,13 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
(atomic_read(&mm->mm_users) != 0));

/*
* mlock: don't page populate if page has PROT_NONE permission.
* munlock: the pages always do munlock althrough
* its has PROT_NONE permission.
* mlock: don't page populate if vma has PROT_NONE permission.
* munlock: always do munlock although the vma has PROT_NONE
* permission, or SIGKILL is pending.
*/
if (!mlock)
gup_flags |= GUP_FLAGS_IGNORE_VMA_PERMISSIONS;
gup_flags |= GUP_FLAGS_IGNORE_VMA_PERMISSIONS |
GUP_FLAGS_IGNORE_SIGKILL;

if (vma->vm_flags & VM_WRITE)
gup_flags |= GUP_FLAGS_WRITE;
Expand Down

0 comments on commit d9c336c

Please sign in to comment.