public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Korty <joe.korty@ccur.com>
To: Rob Love <rml@ximian.com>
Cc: Andrew Morton <akpm@osdl.org>,
	wli@holomorphy.com, albert@users.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: atomic copy_from_user?
Date: Mon, 22 Dec 2003 17:35:48 -0500	[thread overview]
Message-ID: <20031222223547.GA3737@rudolph.ccur.com> (raw)
In-Reply-To: <1072131587.3318.54.camel@fur>

On Mon, Dec 22, 2003 at 05:19:48PM -0500, Rob Love wrote:
> On Mon, 2003-12-22 at 17:14, Andrew Morton wrote:
> 
> > But preempt_enable_no_resched() calls dec_preempt_count().
> 
> Yah, Joe just pointed that out.
> 
> I do not really want to change the base interfaces, anyway ;)
> 
> I do think we should add an explicit preempt_check_resched() after calls
> to dec_preempt_count() where we might be delaying a reschedule, though.

Thanks, Robert and Andrew, for you explanations.  This patch should
do the trick.

Joe


diff -ura base/arch/i386/mm/highmem.c new/arch/i386/mm/highmem.c
--- base/arch/i386/mm/highmem.c	2003-12-17 21:58:56.000000000 -0500
+++ new/arch/i386/mm/highmem.c	2003-12-22 17:32:46.000000000 -0500
@@ -30,6 +30,7 @@
 	enum fixed_addresses idx;
 	unsigned long vaddr;
 
+	/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
 	inc_preempt_count();
 	if (page < highmem_start_page)
 		return page_address(page);
@@ -54,6 +55,7 @@
 
 	if (vaddr < FIXADDR_START) { // FIXME
 		dec_preempt_count();
+		preempt_check_resched();
 		return;
 	}
 
@@ -69,6 +71,7 @@
 #endif
 
 	dec_preempt_count();
+	preempt_check_resched();
 }
 
 struct page *kmap_atomic_to_page(void *ptr)
diff -ura base/arch/mips/mm/highmem.c new/arch/mips/mm/highmem.c
--- base/arch/mips/mm/highmem.c	2003-12-17 21:58:28.000000000 -0500
+++ new/arch/mips/mm/highmem.c	2003-12-22 17:32:59.000000000 -0500
@@ -40,6 +40,7 @@
 	enum fixed_addresses idx;
 	unsigned long vaddr;
 
+	/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
 	inc_preempt_count();
 	if (page < highmem_start_page)
 		return page_address(page);
@@ -64,6 +65,7 @@
 
 	if (vaddr < FIXADDR_START) { // FIXME
 		dec_preempt_count();
+		preempt_check_resched();
 		return;
 	}
 
@@ -79,6 +81,7 @@
 #endif
 
 	dec_preempt_count();
+	preempt_check_resched();
 }
 
 struct page *kmap_atomic_to_page(void *ptr)
diff -ura base/arch/sparc/mm/highmem.c new/arch/sparc/mm/highmem.c
--- base/arch/sparc/mm/highmem.c	2003-12-17 21:58:28.000000000 -0500
+++ new/arch/sparc/mm/highmem.c	2003-12-22 17:33:05.000000000 -0500
@@ -33,6 +33,7 @@
 	unsigned long idx;
 	unsigned long vaddr;
 
+	/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
 	inc_preempt_count();
 	if (page < highmem_start_page)
 		return page_address(page);
@@ -69,6 +70,7 @@
 
 	if (vaddr < fix_kmap_begin) { // FIXME
 		dec_preempt_count();
+		preempt_check_resched();
 		return;
 	}
 
@@ -96,4 +98,5 @@
 #endif
 #endif
 	dec_preempt_count();
+	preempt_check_resched();
 }
diff -ura base/include/asm-ppc/highmem.h new/include/asm-ppc/highmem.h
--- base/include/asm-ppc/highmem.h	2003-12-17 21:59:45.000000000 -0500
+++ new/include/asm-ppc/highmem.h	2003-12-22 17:33:13.000000000 -0500
@@ -81,6 +81,7 @@
 	unsigned int idx;
 	unsigned long vaddr;
 
+	/* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
 	inc_preempt_count();
 	if (page < highmem_start_page)
 		return page_address(page);
@@ -105,6 +106,7 @@
 
 	if (vaddr < KMAP_FIX_BEGIN) { // FIXME
 		dec_preempt_count();
+		preempt_check_resched();
 		return;
 	}
 
@@ -119,6 +121,7 @@
 	flush_tlb_page(0, vaddr);
 #endif
 	dec_preempt_count();
+	preempt_check_resched();
 }
 
 static inline struct page *kmap_atomic_to_page(void *ptr)

  reply	other threads:[~2003-12-22 22:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-22  0:48 atomic copy_from_user? Albert Cahalan
2003-12-22  4:31 ` Linus Torvalds
2003-12-22  9:36   ` Andrew Morton
2003-12-22 15:00 ` William Lee Irwin III
2003-12-22 18:26   ` Joe Korty
2003-12-22 20:55     ` Rob Love
2003-12-22 21:22       ` Joe Korty
2003-12-22 21:40         ` Rob Love
2003-12-22 21:59           ` Joe Korty
2003-12-22 22:14             ` Rob Love
2003-12-22 22:24             ` Andrew Morton
2003-12-22 22:06       ` Joe Korty
2003-12-22 22:18         ` Rob Love
2003-12-22 22:14       ` Andrew Morton
2003-12-22 22:19         ` Rob Love
2003-12-22 22:35           ` Joe Korty [this message]
2003-12-22 22:59             ` Rob Love

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=20031222223547.GA3737@rudolph.ccur.com \
    --to=joe.korty@ccur.com \
    --cc=akpm@osdl.org \
    --cc=albert@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@ximian.com \
    --cc=wli@holomorphy.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox