From: Christoph Lameter <clameter@sgi.com>
To: akpm@osdl.org
Cc: Mike Kravetz <kravetz@us.ibm.com>,
linux-kernel@vger.kernel.org,
Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
Nick Piggin <nickpiggin@yahoo.com.au>,
linux-mm@kvack.org, torvalds@osdl.org,
Christoph Lameter <clameter@sgi.com>,
Hirokazu Takahashi <taka@valinux.co.jp>, Andi Kleen <ak@suse.de>,
Magnus Damm <magnus.damm@gmail.com>, Paul Jackson <pj@sgi.com>,
Dave Hansen <haveblue@us.ibm.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: [PATCH 1/8] Direct Migration V2: Swap migration patchset fixes
Date: Tue, 8 Nov 2005 13:03:11 -0800 (PST) [thread overview]
Message-ID: <20051108210301.31330.5501.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20051108210246.31330.61756.sendpatchset@schroedinger.engr.sgi.com>
Fixes to swap migration patch V5 (may already be in mm)
- Fix comment for isolate_lru_page() and the check for the result
of __isolate_lru_page in isolate_lru_pages()
- migrate_page_add: check for mapping == NULL
- check_range: Its okay if the first vma has the flag VM_RESERVED set if the
MPOL_MF_DISCONTIG_OK flag was specified by the caller.
- Change the permission check to use comparisons instead of XORs.
Revise the comments.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.14-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.14-mm1.orig/mm/vmscan.c 2005-11-07 11:48:47.000000000 -0800
+++ linux-2.6.14-mm1/mm/vmscan.c 2005-11-08 11:17:13.000000000 -0800
@@ -755,7 +755,7 @@ static int isolate_lru_pages(struct zone
/* Succeeded to isolate page */
list_add(&page->lru, dst);
break;
- case -1:
+ case -ENOENT:
/* Not possible to isolate */
list_move(&page->lru, src);
break;
@@ -782,7 +782,7 @@ static void lru_add_drain_per_cpu(void *
* Result:
* 0 = page not on LRU list
* 1 = page removed from LRU list and added to the specified list.
- * -1 = page is being freed elsewhere.
+ * -ENOENT = page is being freed elsewhere.
*/
int isolate_lru_page(struct page *page)
{
Index: linux-2.6.14-mm1/mm/mempolicy.c
===================================================================
--- linux-2.6.14-mm1.orig/mm/mempolicy.c 2005-11-07 11:48:26.000000000 -0800
+++ linux-2.6.14-mm1/mm/mempolicy.c 2005-11-08 11:16:42.000000000 -0800
@@ -217,6 +217,7 @@ static void migrate_page_add(struct vm_a
* Avoid migrating a page that is shared by others and not writable.
*/
if ((flags & MPOL_MF_MOVE_ALL) ||
+ !page->mapping ||
PageAnon(page) ||
mapping_writably_mapped(page->mapping) ||
single_mm_mapping(vma->vm_mm, page->mapping)
@@ -359,7 +360,8 @@ check_range(struct mm_struct *mm, unsign
first = find_vma(mm, start);
if (!first)
return ERR_PTR(-EFAULT);
- if (first->vm_flags & VM_RESERVED)
+ if (first->vm_flags & VM_RESERVED &&
+ !(flags & MPOL_MF_DISCONTIG_OK))
return ERR_PTR(-EACCES);
prev = NULL;
for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) {
@@ -790,18 +792,13 @@ asmlinkage long sys_migrate_pages(pid_t
return -EINVAL;
/*
- * We only allow a process to move the pages of another
- * if the process issuing sys_migrate has the right to send a kill
- * signal to the process to be moved. Moving another processes
- * memory may impact the performance of that process. If the
- * process issuing sys_migrate_pages has the right to kill the
- * target process then obviously that process has the right to
- * impact the performance of the target process.
- *
- * The permission check was taken from check_kill_permission()
+ * Check if this process has the right to modify the specified
+ * process. The right exists if the process has administrative
+ * capabilities, superuser priviledges or the same
+ * userid as the target process.
*/
- if ((current->euid ^ task->suid) && (current->euid ^ task->uid) &&
- (current->uid ^ task->suid) && (current->uid ^ task->uid) &&
+ if ((current->euid != task->suid) && (current->euid != task->uid) &&
+ (current->uid != task->suid) && (current->uid != task->uid) &&
!capable(CAP_SYS_ADMIN)) {
err = -EPERM;
goto out;
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Lameter <clameter@sgi.com>
To: akpm@osdl.org
Cc: Mike Kravetz <kravetz@us.ibm.com>,
linux-kernel@vger.kernel.org,
Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
Nick Piggin <nickpiggin@yahoo.com.au>,
linux-mm@kvack.org, torvalds@osdl.org,
Christoph Lameter <clameter@sgi.com>,
Hirokazu Takahashi <taka@valinux.co.jp>, Andi Kleen <ak@suse.de>,
Magnus Damm <magnus.damm@gmail.com>, Paul Jackson <pj@sgi.com>,
Dave Hansen <haveblue@us.ibm.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: [PATCH 1/8] Direct Migration V2: Swap migration patchset fixes
Date: Tue, 8 Nov 2005 13:03:11 -0800 (PST) [thread overview]
Message-ID: <20051108210301.31330.5501.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20051108210246.31330.61756.sendpatchset@schroedinger.engr.sgi.com>
Fixes to swap migration patch V5 (may already be in mm)
- Fix comment for isolate_lru_page() and the check for the result
of __isolate_lru_page in isolate_lru_pages()
- migrate_page_add: check for mapping == NULL
- check_range: Its okay if the first vma has the flag VM_RESERVED set if the
MPOL_MF_DISCONTIG_OK flag was specified by the caller.
- Change the permission check to use comparisons instead of XORs.
Revise the comments.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.14-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.14-mm1.orig/mm/vmscan.c 2005-11-07 11:48:47.000000000 -0800
+++ linux-2.6.14-mm1/mm/vmscan.c 2005-11-08 11:17:13.000000000 -0800
@@ -755,7 +755,7 @@ static int isolate_lru_pages(struct zone
/* Succeeded to isolate page */
list_add(&page->lru, dst);
break;
- case -1:
+ case -ENOENT:
/* Not possible to isolate */
list_move(&page->lru, src);
break;
@@ -782,7 +782,7 @@ static void lru_add_drain_per_cpu(void *
* Result:
* 0 = page not on LRU list
* 1 = page removed from LRU list and added to the specified list.
- * -1 = page is being freed elsewhere.
+ * -ENOENT = page is being freed elsewhere.
*/
int isolate_lru_page(struct page *page)
{
Index: linux-2.6.14-mm1/mm/mempolicy.c
===================================================================
--- linux-2.6.14-mm1.orig/mm/mempolicy.c 2005-11-07 11:48:26.000000000 -0800
+++ linux-2.6.14-mm1/mm/mempolicy.c 2005-11-08 11:16:42.000000000 -0800
@@ -217,6 +217,7 @@ static void migrate_page_add(struct vm_a
* Avoid migrating a page that is shared by others and not writable.
*/
if ((flags & MPOL_MF_MOVE_ALL) ||
+ !page->mapping ||
PageAnon(page) ||
mapping_writably_mapped(page->mapping) ||
single_mm_mapping(vma->vm_mm, page->mapping)
@@ -359,7 +360,8 @@ check_range(struct mm_struct *mm, unsign
first = find_vma(mm, start);
if (!first)
return ERR_PTR(-EFAULT);
- if (first->vm_flags & VM_RESERVED)
+ if (first->vm_flags & VM_RESERVED &&
+ !(flags & MPOL_MF_DISCONTIG_OK))
return ERR_PTR(-EACCES);
prev = NULL;
for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) {
@@ -790,18 +792,13 @@ asmlinkage long sys_migrate_pages(pid_t
return -EINVAL;
/*
- * We only allow a process to move the pages of another
- * if the process issuing sys_migrate has the right to send a kill
- * signal to the process to be moved. Moving another processes
- * memory may impact the performance of that process. If the
- * process issuing sys_migrate_pages has the right to kill the
- * target process then obviously that process has the right to
- * impact the performance of the target process.
- *
- * The permission check was taken from check_kill_permission()
+ * Check if this process has the right to modify the specified
+ * process. The right exists if the process has administrative
+ * capabilities, superuser priviledges or the same
+ * userid as the target process.
*/
- if ((current->euid ^ task->suid) && (current->euid ^ task->uid) &&
- (current->uid ^ task->suid) && (current->uid ^ task->uid) &&
+ if ((current->euid != task->suid) && (current->euid != task->uid) &&
+ (current->uid != task->suid) && (current->uid != task->uid) &&
!capable(CAP_SYS_ADMIN)) {
err = -EPERM;
goto out;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2005-11-08 21:03 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-08 21:02 [PATCH 0/8] Direct Migration V2: Overview Christoph Lameter
2005-11-08 21:02 ` Christoph Lameter
2005-11-08 21:03 ` Christoph Lameter [this message]
2005-11-08 21:03 ` [PATCH 1/8] Direct Migration V2: Swap migration patchset fixes Christoph Lameter
2005-11-08 21:03 ` [PATCH 2/8] Direct Migration V2: PageSwapCache checks Christoph Lameter
2005-11-08 21:03 ` Christoph Lameter
2005-11-08 21:03 ` [PATCH 3/8] Direct Migration V2: migrate_pages() extension Christoph Lameter
2005-11-08 21:03 ` Christoph Lameter
2005-11-08 21:03 ` [PATCH 4/8] Direct Migration V2: remove_from_swap() to remove swap ptes Christoph Lameter
2005-11-08 21:03 ` Christoph Lameter
2005-11-08 21:04 ` [PATCH 5/8] Direct Migration V2: upgrade MPOL_MF_MOVE and sys_migrate_pages() Christoph Lameter
2005-11-08 21:04 ` Christoph Lameter
2005-11-09 1:35 ` KAMEZAWA Hiroyuki
2005-11-09 1:35 ` KAMEZAWA Hiroyuki
2005-11-09 3:23 ` Christoph Lameter
2005-11-09 3:23 ` Christoph Lameter
2005-11-09 3:59 ` KAMEZAWA Hiroyuki
2005-11-09 3:59 ` KAMEZAWA Hiroyuki
2005-11-09 16:50 ` Christoph Lameter
2005-11-09 16:50 ` Christoph Lameter
2005-11-08 21:04 ` [PATCH 6/8] Direct Migration V2: Avoid writeback / page_migrate() method Christoph Lameter
2005-11-08 21:04 ` Christoph Lameter
2005-11-09 11:01 ` Nikita Danilov
2005-11-09 11:01 ` Nikita Danilov
2005-11-09 17:07 ` Christoph Lameter
2005-11-09 17:07 ` Christoph Lameter
2005-11-09 17:20 ` Nikita Danilov
2005-11-09 17:20 ` Nikita Danilov
2005-11-09 19:14 ` Christoph Lameter
2005-11-09 19:14 ` Christoph Lameter
2005-11-08 21:04 ` [PATCH 7/8] Direct Migration V2: add_to_swap() with additional gfp_t parameter Christoph Lameter
2005-11-08 21:04 ` Christoph Lameter
2005-11-08 21:04 ` [PATCH 8/8] Direct Migration V2: SWAP_REFERENCE for try_to_unmap() Christoph Lameter
2005-11-08 21:04 ` Christoph Lameter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051108210301.31330.5501.sendpatchset@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=haveblue@us.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kravetz@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=magnus.damm@gmail.com \
--cc=marcelo.tosatti@cyclades.com \
--cc=nickpiggin@yahoo.com.au \
--cc=pj@sgi.com \
--cc=taka@valinux.co.jp \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.