Skip to contentSkip to conversation

handle_mm_fault() calling convention cleanup..

PATCH In review Linus Torvalds 13 participants 21 messages Jun 21, 2009 – Jul 6, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Just a heads up that I committed the patches that I sent out two months ago to make the fault handling routines use the finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write".

That was originally for the NOPAGE_RETRY patches, but it's a general cleanup too. I have this suspicion that we should extend this to "get_user_pages()" too, instead of having those boolean "write" and "force" flags (and GUP_FLAGS_xyzzy as opposed to FAULT_FLAGS_yyzzy).

We should probably also get rid of the insane FOLL_xyz flags too. Right now the code in fact depends on FOLL_WRITE being the same as FAULT_FLAGS_WRITE, and while that is a simple dependency, it's just crazy how we have all these different flags for what ends up often boiling down to the same fundamental issue in the end (even if not all versions of the flags are necessarily always valid for all uses).

I fixed up all architectures that I noticed (at least microblaze had been added since the original patches in April), but arch maintainers should double-check. Arch maintainers might also want to check whether the mindless conversion of

	'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0'

might perhaps be written in some more natural way (for example, maybe you'd like to get rid of 'iswrite' as a variable entirely, and replace it with a 'fault_flags' variable).

It's pushed out and tested on x86-64, but it really was such a mindless conversion that I hope it works on all architectures. But I thought I'd better give people a shout-out regardless.

Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw

From: Linus Torvalds <[email protected]>
Date: Sun, 21 Jun 2009 13:42:35 -0700 (PDT)

Quoted 7 lines

I fixed up all architectures that I noticed (at least microblaze had been added since the original patches in April), but arch maintainers should double-check. Arch maintainers might also want to check whether the mindless conversion of

	'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0'
Quoted 7 lines

might perhaps be written in some more natural way (for example, maybe you'd like to get rid of 'iswrite' as a variable entirely, and replace it with a 'fault_flags' variable).

It's pushed out and tested on x86-64, but it really was such a mindless conversion that I hope it works on all architectures. But I thought I'd better give people a shout-out regardless.

Sparc looks good, and sparc64 seems to work fine.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
In reply to Linus Torvalds
Quoted 4 lines · Linus Torvalds

Just a heads up that I committed the patches that I sent out two months ago to make the fault handling routines use the finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write".

All is fine on x86.

Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
In reply to Linus Torvalds
Quoted 3 lines · On Sun, 21 Jun 2009 13:42:35 -0700 (PDT) Linus Torvalds…

Just a heads up that I committed the patches that I sent out two months ago to make the fault handling routines use the finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write".

Todays git tree still works on s390.

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#4 lore raw
In reply to Linus Torvalds
Quoted 3 lines · Linus Torvalds

It's pushed out and tested on x86-64, but it really was such a mindless conversion that I hope it works on all architectures. But I thought I'd better give people a shout-out regardless.

Works on FRV and MN10300.

David

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw
In reply to Linus Torvalds
Quoted 3 lines · Linus Torvalds

It's pushed out and tested on x86-64, but it really was such a mindless conversion that I hope it works on all architectures. But I thought I'd better give people a shout-out regardless.

Works fine on ARM, thanks.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#7 lore raw
In reply to Linus Torvalds
Quoted 4 lines · Linus Torvalds

Just a heads up that I committed the patches that I sent out two months ago to make the fault handling routines use the finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write".

While you've got everyone's attention, may I just remind arch maintainers to consider using pagefault_out_of_memory() rather than unconditional kill current in the pagefault OOM case. See x86.

Thanks,
Nick

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#8 lore raw

PATCH 1/1 hugetlb: fault flags instead of write_access

In reply to Linus Torvalds

handle_mm_fault() is now passing fault flags rather than write_access down to hugetlb_fault(), so better recognize that in hugetlb_fault(), and in hugetlb_no_page().

---

 include/linux/hugetlb.h |    4 ++--
 mm/hugetlb.c            |   17 +++++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)
include/linux/hugetlb.h +2 -2
@@ -33,7 +33,7 @@ void hugetlb_report_meminfo(struct seq_f
 int hugetlb_report_node_meminfo(int, char *);
 unsigned long hugetlb_total_pages(void);
 int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
-			unsigned long address, int write_access);
+			unsigned long address, unsigned int flags);
 int hugetlb_reserve_pages(struct inode *inode, long from, long to,
 						struct vm_area_struct *vma,
 						int acctflags);
@@ -98,7 +98,7 @@ static inline void hugetlb_report_meminf
 #define pud_huge(x)	0
 #define is_hugepage_only_range(mm, addr, len)	0
 #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
-#define hugetlb_fault(mm, vma, addr, write)	({ BUG(); 0; })
+#define hugetlb_fault(mm, vma, addr, flags)	({ BUG(); 0; })
 
 #define hugetlb_change_protection(vma, address, end, newprot)
 
mm/hugetlb.c +9 -8
@@ -1985,7 +1985,7 @@ static struct page *hugetlbfs_pagecache_
 }
 
 static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
-			unsigned long address, pte_t *ptep, int write_access)
+			unsigned long address, pte_t *ptep, unsigned int flags)
 {
 	struct hstate *h = hstate_vma(vma);
 	int ret = VM_FAULT_SIGBUS;
@@ -2053,7 +2053,7 @@ retry:
 	 * any allocations necessary to record that reservation occur outside
 	 * the spinlock.
 	 */
-	if (write_access && !(vma->vm_flags & VM_SHARED))
+	if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED))
 		if (vma_needs_reservation(h, vma, address) < 0) {
 			ret = VM_FAULT_OOM;
 			goto backout_unlocked;
@@ -2072,7 +2072,7 @@ retry:
 				&& (vma->vm_flags & VM_SHARED)));
 	set_huge_pte_at(mm, address, ptep, new_pte);
 
-	if (write_access && !(vma->vm_flags & VM_SHARED)) {
+	if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) {
 		/* Optimization, do the COW without a second fault */
 		ret = hugetlb_cow(mm, vma, address, ptep, new_pte, page);
 	}
@@ -2091,7 +2091,7 @@ backout_unlocked:
 }
 
 int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
-			unsigned long address, int write_access)
+			unsigned long address, unsigned int flags)
 {
 	pte_t *ptep;
 	pte_t entry;
@@ -2112,7 +2112,7 @@ int hugetlb_fault(struct mm_struct *mm,
 	mutex_lock(&hugetlb_instantiation_mutex);
 	entry = huge_ptep_get(ptep);
 	if (huge_pte_none(entry)) {
-		ret = hugetlb_no_page(mm, vma, address, ptep, write_access);
+		ret = hugetlb_no_page(mm, vma, address, ptep, flags);
 		goto out_mutex;
 	}
 
@@ -2126,7 +2126,7 @@ int hugetlb_fault(struct mm_struct *mm,
 	 * page now as it is used to determine if a reservation has been
 	 * consumed.
 	 */
-	if (write_access && !pte_write(entry)) {
+	if ((flags & FAULT_FLAG_WRITE) && !pte_write(entry)) {
 		if (vma_needs_reservation(h, vma, address) < 0) {
 			ret = VM_FAULT_OOM;
 			goto out_mutex;
@@ -2143,7 +2143,7 @@ int hugetlb_fault(struct mm_struct *mm,
 		goto out_page_table_lock;
 
 
-	if (write_access) {
+	if (flags & FAULT_FLAG_WRITE) {
 		if (!pte_write(entry)) {
 			ret = hugetlb_cow(mm, vma, address, ptep, entry,
 							pagecache_page);
@@ -2152,7 +2152,8 @@ int hugetlb_fault(struct mm_struct *mm,
 		entry = pte_mkdirty(entry);
 	}
 	entry = pte_mkyoung(entry);
-	if (huge_ptep_set_access_flags(vma, address, ptep, entry, write_access))
+	if (huge_ptep_set_access_flags(vma, address, ptep, entry,
+						flags & FAULT_FLAG_WRITE))
 		update_mmu_cache(vma, address, entry);
 
 out_page_table_lock:

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#9 lore raw

Re: [PATCH] hugetlb: fault flags instead of write_access

Quoted 5 lines · Hugh Dickins

handle_mm_fault() is now passing fault flags rather than write_access down to hugetlb_fault(), so better recognize that in hugetlb_fault(), and in hugetlb_no_page().

Looks OK and compiles OK.

Thanks,
Fengguang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Reviewed-by on v1 1/1
#10 lore raw

Re: [PATCH] hugetlb: fault flags instead of write_access

In reply to Hugh Dickins
Quoted 5 lines · Hugh Dickins

handle_mm_fault() is now passing fault flags rather than write_access down to hugetlb_fault(), so better recognize that in hugetlb_fault(), and in hugetlb_no_page().

Signature · 7 lines
All rights reversed.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v1 1/1
#11 lore raw

Re: [PATCH] hugetlb: fault flags instead of write_access

In reply to Hugh Dickins
Quoted 5 lines · Hugh Dickins

handle_mm_fault() is now passing fault flags rather than write_access down to hugetlb_fault(), so better recognize that in hugetlb_fault(), and in hugetlb_no_page().

Patch looks good and passes libhugetlbfs regression tests. It passes with or without the tests but without this patch, it's only a co-incidence it passes as opposed to designed.

Quoted 108 lines

---

 include/linux/hugetlb.h |    4 ++--
 mm/hugetlb.c            |   17 +++++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)
include/linux/hugetlb.h +2 -2
@@ -33,7 +33,7 @@ void hugetlb_report_meminfo(struct seq_f
 int hugetlb_report_node_meminfo(int, char *);
 unsigned long hugetlb_total_pages(void);
 int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
-			unsigned long address, int write_access);
+			unsigned long address, unsigned int flags);
 int hugetlb_reserve_pages(struct inode *inode, long from, long to,
 						struct vm_area_struct *vma,
 						int acctflags);
@@ -98,7 +98,7 @@ static inline void hugetlb_report_meminf
 #define pud_huge(x)	0
 #define is_hugepage_only_range(mm, addr, len)	0
 #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
-#define hugetlb_fault(mm, vma, addr, write)	({ BUG(); 0; })
+#define hugetlb_fault(mm, vma, addr, flags)	({ BUG(); 0; })
 
 #define hugetlb_change_protection(vma, address, end, newprot)
 
mm/hugetlb.c +9 -9
@@ -1985,7 +1985,7 @@ static struct page *hugetlbfs_pagecache_
 }
 
 static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
-			unsigned long address, pte_t *ptep, int write_access)
+			unsigned long address, pte_t *ptep, unsigned int flags)
 {
 	struct hstate *h = hstate_vma(vma);
 	int ret = VM_FAULT_SIGBUS;
@@ -2053,7 +2053,7 @@ retry:
 	 * any allocations necessary to record that reservation occur outside
 	 * the spinlock.
 	 */
-	if (write_access && !(vma->vm_flags & VM_SHARED))
+	if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED))
 		if (vma_needs_reservation(h, vma, address) < 0) {
 			ret = VM_FAULT_OOM;
 			goto backout_unlocked;
@@ -2072,7 +2072,7 @@ retry:
 				&& (vma->vm_flags & VM_SHARED)));
 	set_huge_pte_at(mm, address, ptep, new_pte);
 
-	if (write_access && !(vma->vm_flags & VM_SHARED)) {
+	if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) {
 		/* Optimization, do the COW without a second fault */
 		ret = hugetlb_cow(mm, vma, address, ptep, new_pte, page);
 	}
@@ -2091,7 +2091,7 @@ backout_unlocked:
 }
 
 int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
-			unsigned long address, int write_access)
+			unsigned long address, unsigned int flags)
 {
 	pte_t *ptep;
 	pte_t entry;
@@ -2112,7 +2112,7 @@ int hugetlb_fault(struct mm_struct *mm,
 	mutex_lock(&hugetlb_instantiation_mutex);
 	entry = huge_ptep_get(ptep);
 	if (huge_pte_none(entry)) {
-		ret = hugetlb_no_page(mm, vma, address, ptep, write_access);
+		ret = hugetlb_no_page(mm, vma, address, ptep, flags);
 		goto out_mutex;
 	}
 
@@ -2126,7 +2126,7 @@ int hugetlb_fault(struct mm_struct *mm,
 	 * page now as it is used to determine if a reservation has been
 	 * consumed.
 	 */
-	if (write_access && !pte_write(entry)) {
+	if ((flags & FAULT_FLAG_WRITE) && !pte_write(entry)) {
 		if (vma_needs_reservation(h, vma, address) < 0) {
 			ret = VM_FAULT_OOM;
 			goto out_mutex;
@@ -2143,7 +2143,7 @@ int hugetlb_fault(struct mm_struct *mm,
 		goto out_page_table_lock;
 
 
-	if (write_access) {
+	if (flags & FAULT_FLAG_WRITE) {
 		if (!pte_write(entry)) {
 			ret = hugetlb_cow(mm, vma, address, ptep, entry,
 							pagecache_page);
@@ -2152,7 +2152,8 @@ int hugetlb_fault(struct mm_struct *mm,
 		entry = pte_mkdirty(entry);
 	}
 	entry = pte_mkyoung(entry);
-	if (huge_ptep_set_access_flags(vma, address, ptep, entry, write_access))
+	if (huge_ptep_set_access_flags(vma, address, ptep, entry,
+						flags & FAULT_FLAG_WRITE))
 		update_mmu_cache(vma, address, entry);
 
 out_page_table_lock:
 
--

To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#12 lore raw

PATCH 1/1 mm: don't rely on flags coincidence

In reply to Linus Torvalds

Indeed FOLL_WRITE matches FAULT_FLAG_WRITE, matches GUP_FLAGS_WRITE, and it's tempting to devise a set of Grand Unified Paging flags; but not today. So until then, let's rely upon the compiler to spot the coincidence, "rather than have that subtle dependency and a comment for it" - as you remarked in another context yesterday.

---

 mm/memory.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
mm/memory.c +4 -2
@@ -1311,8 +1311,10 @@ int __get_user_pages(struct task_struct
 			while (!(page = follow_page(vma, start, foll_flags))) {
 				int ret;
 
-				/* FOLL_WRITE matches FAULT_FLAG_WRITE! */
-				ret = handle_mm_fault(mm, vma, start, foll_flags & FOLL_WRITE);
+				ret = handle_mm_fault(mm, vma, start,
+					(foll_flags & FOLL_WRITE) ?
+					FAULT_FLAG_WRITE : 0);
+
 				if (ret & VM_FAULT_ERROR) {
 					if (ret & VM_FAULT_OOM)
 						return i ? i : -ENOMEM;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#13 lore raw

Re: [PATCH] mm: don't rely on flags coincidence

Quoted 7 lines · Hugh Dickins

Indeed FOLL_WRITE matches FAULT_FLAG_WRITE, matches GUP_FLAGS_WRITE, and it's tempting to devise a set of Grand Unified Paging flags; but not today. So until then, let's rely upon the compiler to spot the coincidence, "rather than have that subtle dependency and a comment for it" - as you remarked in another context yesterday.

Quoted 10 lines

---

 mm/memory.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
mm/memory.c +0 -0
@@ -1311,8 +1311,10 @@ int __get_user_pages(struct task_struct
 			while (!(page = follow_page(vma, start, foll_flags))) {
 				int ret;

mm/memory.c int __get_user_pages(struct task_struct · line 1320

Quoted 10 lines
mm/memory.c +4 -2
 
-				/* FOLL_WRITE matches FAULT_FLAG_WRITE! */
-				ret = handle_mm_fault(mm, vma, start, foll_flags & FOLL_WRITE);
+				ret = handle_mm_fault(mm, vma, start,
+					(foll_flags & FOLL_WRITE) ?
+					FAULT_FLAG_WRITE : 0);
+
 				if (ret & VM_FAULT_ERROR) {
 					if (ret & VM_FAULT_OOM)
 						return i ? i : -ENOMEM;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Reviewed-by on v1 1/1
#14 lore raw

Re: [PATCH] mm: don't rely on flags coincidence

In reply to Hugh Dickins
Quoted 7 lines · Hugh Dickins

Indeed FOLL_WRITE matches FAULT_FLAG_WRITE, matches GUP_FLAGS_WRITE, and it's tempting to devise a set of Grand Unified Paging flags; but not today. So until then, let's rely upon the compiler to spot the coincidence, "rather than have that subtle dependency and a comment for it" - as you remarked in another context yesterday.

Good catch.

Signature · 7 lines
All rights reversed.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#15 lore raw
In reply to Linus Torvalds
Quoted 8 lines · Linus Torvalds

Just a heads up that I committed the patches that I sent out two months ago to make the fault handling routines use the finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write".

That was originally for the NOPAGE_RETRY patches, but it's a general cleanup too. I have this suspicion that we should extend this to "get_user_pages()" too, instead of having those boolean "write" and "force" flags (and GUP_FLAGS_xyzzy as opposed to FAULT_FLAGS_yyzzy).

BTW. I'd like to extend these if there's no objection one of these days to also pass whether it was an exec fault, and pass the full flags to ptep_set_access_flags().

That would (finally) give us a better hook for architectures that need to do it to handle i$/d$ coherency. Right now, I go dig for the current fault type inside the current pt_regs from ptep_set_access_flags() which is positively ugly.

Ben.

Quoted 22 lines

We should probably also get rid of the insane FOLL_xyz flags too. Right now the code in fact depends on FOLL_WRITE being the same as FAULT_FLAGS_WRITE, and while that is a simple dependency, it's just crazy how we have all these different flags for what ends up often boiling down to the same fundamental issue in the end (even if not all versions of the flags are necessarily always valid for all uses).

I fixed up all architectures that I noticed (at least microblaze had been added since the original patches in April), but arch maintainers should double-check. Arch maintainers might also want to check whether the mindless conversion of

	'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0'

might perhaps be written in some more natural way (for example, maybe you'd like to get rid of 'iswrite' as a variable entirely, and replace it with a 'fault_flags' variable).

It's pushed out and tested on x86-64, but it really was such a mindless conversion that I hope it works on all architectures. But I thought I'd better give people a shout-out regardless.

Quoted 7 lines

Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#16 lore raw
Quoted 4 lines · Benjamin Herrenschmidt

BTW. I'd like to extend these if there's no objection one of these days to also pass whether it was an exec fault, and pass the full flags to ptep_set_access_flags().

Sure. No problem, and sounds sane.

Just a tiny word of warning: right now, the conversion I did pretty much depended on the fact that even if I missed a spot, it wouldn't actually make any difference. If somebody used "flags" as a binary value (ie like the old "write_access" kind of semantics), things would still all work, because it was still a "zero-vs-nonzero" issue wrt writes.

And there were cases in the hugepage handling that I had missed, that Hugh picked up. Maybe he picked them all - but be careful.

I didn't add any flags (like the FAULT_FLAG_RETRY thing that started it all) that would actually _require_ everybody to always treat it as a bitmask. And some places still pass the flags down as basically just the "write or not" thing. ptep_set_access_flags() stands out as one of them (and I think your suggestion would actually clean things up), but there are probably others.

Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#17 lore raw
Quoted 5 lines · Linus Torvalds

Just a tiny word of warning: right now, the conversion I did pretty much depended on the fact that even if I missed a spot, it wouldn't actually make any difference. If somebody used "flags" as a binary value (ie like the old "write_access" kind of semantics), things would still all work, because it was still a "zero-vs-nonzero" issue wrt writes.

.../...

Right. Oh well.. we'll see when I get to it. I have a few higher priority things on my pile at the moment.

Cheers,
Ben.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#18 lore raw
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 5 lines · Linus Torvalds

Just a tiny word of warning: right now, the conversion I did pretty much depended on the fact that even if I missed a spot, it wouldn't actually make any difference. If somebody used "flags" as a binary value (ie like the old "write_access" kind of semantics), things would still all work, because it was still a "zero-vs-nonzero" issue wrt writes.

Quoted 4 lines

.../...

Right. Oh well.. we'll see when I get to it. I have a few higher priority things on my pile at the moment.

I have no problems with that. I'd always intended to have flags go further up the call chain like Linus did (since we'd discussed perhaps making faults interruptible and requiring an extra flag to distinguish get_user_pages callers that were not interruptible).

So yes adding more flags to improve code or make things simpler is fine by me :)

Thanks,
Nick

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#19 lore raw
Quoted 8 lines · Nick Piggin

I have no problems with that. I'd always intended to have flags go further up the call chain like Linus did (since we'd discussed perhaps making faults interruptible and requiring an extra flag to distinguish get_user_pages callers that were not interruptible).

So yes adding more flags to improve code or make things simpler is fine by me :)

That's before you see my evil plan of bringing the flags all the way down to set_pte_at() :-)

Cheers,
Ben.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#20 lore raw
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 8 lines · Nick Piggin

I have no problems with that. I'd always intended to have flags go further up the call chain like Linus did (since we'd discussed perhaps making faults interruptible and requiring an extra flag to distinguish get_user_pages callers that were not interruptible).

So yes adding more flags to improve code or make things simpler is fine by me :)

That's before you see my evil plan of bringing the flags all the way down to set_pte_at() :-)

So long as it can be nooped out of x86 I don't see it being a problem.

One problem x86 has with the mm/memory.c code is that it runs out of registers (especially in fork/exit iirc). So I wouldn't like to add unnecessary arguments to functions if they cannot be optimised away.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>