* Helding the Kernel lock while doing IO???
@ 2000-05-06 1:30 Juan J. Quintela
2000-05-06 1:34 ` Helding the Kernel lock while doing IO??? (take 2) Juan J. Quintela
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Juan J. Quintela @ 2000-05-06 1:30 UTC (permalink / raw)
To: linux-mm, linux-kernel, Linus Torvalds
Hi
In the function m/memory.c()::do_swap_page():
lock_kernel();
swapin_readahead(entry);
page = read_swap_cache(entry);
unlock_kernel();
read_swap_cache is called synchronously, then we can have to wait
until we read the page to liberate the lock kernel. It is intended?
I am losing some detail?
I have changed that in the two places that happened.
Thanks in advance for any response.
Later, Juan.
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* --exclude=TAGS pre7-6/ipc/shm.c testing2/ipc/shm.c
--- pre7-6/ipc/shm.c Fri May 5 23:58:56 2000
+++ testing2/ipc/shm.c Sat May 6 02:39:17 2000
@@ -1379,10 +1379,11 @@
if (!page) {
lock_kernel();
swapin_readahead(entry);
- page = read_swap_cache(entry);
+ page = read_swap_cache_async(entry, 0);
unlock_kernel();
if (!page)
goto oom;
+ wait_on_page(page);
}
delete_from_swap_cache(page);
page = replace_with_highmem(page);
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* --exclude=TAGS pre7-6/mm/memory.c testing2/mm/memory.c
--- pre7-6/mm/memory.c Fri May 5 23:58:56 2000
+++ testing2/mm/memory.c Sat May 6 02:02:53 2000
@@ -1038,11 +1038,10 @@
if (!page) {
lock_kernel();
swapin_readahead(entry);
- page = read_swap_cache(entry);
+ page = read_swap_cache_async(entry, 0);
unlock_kernel();
if (!page)
return -1;
-
flush_page_to_ram(page);
flush_icache_page(vma, page);
}
--
In theory, practice and theory are the same, but in practice they
are different -- Larry McVoy
--
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.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Helding the Kernel lock while doing IO??? (take 2)
2000-05-06 1:30 Helding the Kernel lock while doing IO??? Juan J. Quintela
@ 2000-05-06 1:34 ` Juan J. Quintela
2000-05-06 11:48 ` Helding the Kernel lock while doing IO??? Stephen C. Tweedie
2000-05-06 13:16 ` Andrea Arcangeli
2 siblings, 0 replies; 5+ messages in thread
From: Juan J. Quintela @ 2000-05-06 1:34 UTC (permalink / raw)
To: linux-mm; +Cc: linux-kernel, Linus Torvalds
>>>>> "juan" == Juan J Quintela <quintela@fi.udc.es> writes:
juan> Hi
juan> In the function m/memory.c()::do_swap_page():
juan> lock_kernel();
juan> swapin_readahead(entry);
juan> page = read_swap_cache(entry);
juan> unlock_kernel();
juan> read_swap_cache is called synchronously, then we can have to wait
juan> until we read the page to liberate the lock kernel. It is intended?
juan> I am losing some detail?
juan> I have changed that in the two places that happened.
juan> Thanks in advance for any response.
Sorry for the inconveniences.
First one lacks a wait_on_page:
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* --exclude=TAGS pre7-6/ipc/shm.c testing/ipc/shm.c
--- pre7-6/ipc/shm.c Fri May 5 23:58:56 2000
+++ testing/ipc/shm.c Sat May 6 03:16:34 2000
@@ -1379,10 +1379,11 @@
if (!page) {
lock_kernel();
swapin_readahead(entry);
- page = read_swap_cache(entry);
+ page = read_swap_cache_async(entry, 0);
unlock_kernel();
if (!page)
goto oom;
+ wait_on_page(page);
}
delete_from_swap_cache(page);
page = replace_with_highmem(page);
diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* --exclude=TAGS pre7-6/mm/memory.c testing/mm/memory.c
--- pre7-6/mm/memory.c Fri May 5 23:58:56 2000
+++ testing/mm/memory.c Sat May 6 03:25:47 2000
@@ -1038,11 +1038,11 @@
if (!page) {
lock_kernel();
swapin_readahead(entry);
- page = read_swap_cache(entry);
+ page = read_swap_cache_async(entry, 0);
unlock_kernel();
if (!page)
return -1;
-
+ wait_on_page(page);
flush_page_to_ram(page);
flush_icache_page(vma, page);
}
--
In theory, practice and theory are the same, but in practice they
are different -- Larry McVoy
--
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.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Helding the Kernel lock while doing IO???
2000-05-06 1:30 Helding the Kernel lock while doing IO??? Juan J. Quintela
2000-05-06 1:34 ` Helding the Kernel lock while doing IO??? (take 2) Juan J. Quintela
@ 2000-05-06 11:48 ` Stephen C. Tweedie
2000-05-14 22:02 ` PATCH: " Juan J. Quintela
2000-05-06 13:16 ` Andrea Arcangeli
2 siblings, 1 reply; 5+ messages in thread
From: Stephen C. Tweedie @ 2000-05-06 11:48 UTC (permalink / raw)
To: Juan J. Quintela; +Cc: linux-mm, linux-kernel, Linus Torvalds, Stephen Tweedie
Hi,
On Sat, May 06, 2000 at 03:30:47AM +0200, Juan J. Quintela wrote:
>
> read_swap_cache is called synchronously, then we can have to wait
> until we read the page to liberate the lock kernel. It is intended?
> I am losing some detail?
Holding the big kernel lock while we sleep is quite legal. The
scheduler drops the lock while we sleep and reacquires it when we
are rescheduled. The lock_kernel() lock is not at all like other
spinlocks.
--Stephen
--
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.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 5+ messages in thread
* PATCH: Re: Helding the Kernel lock while doing IO???
2000-05-06 11:48 ` Helding the Kernel lock while doing IO??? Stephen C. Tweedie
@ 2000-05-14 22:02 ` Juan J. Quintela
0 siblings, 0 replies; 5+ messages in thread
From: Juan J. Quintela @ 2000-05-14 22:02 UTC (permalink / raw)
To: Stephen C. Tweedie; +Cc: linux-mm, linux-kernel, Linus Torvalds
>>>>> "stephen" == Stephen C Tweedie <sct@redhat.com> writes:
stephen> Hi,
stephen> On Sat, May 06, 2000 at 03:30:47AM +0200, Juan J. Quintela wrote:
>>
>> read_swap_cache is called synchronously, then we can have to wait
>> until we read the page to liberate the lock kernel. It is intended?
>> I am losing some detail?
stephen> Holding the big kernel lock while we sleep is quite legal. The
stephen> scheduler drops the lock while we sleep and reacquires it when we
stephen> are rescheduled. The lock_kernel() lock is not at all like other
stephen> spinlocks.
Thanks again for the comment, what do you think about add a comment
about that? Patch attached.
Later, Juan.
diff -urN --exclude-from=/home/lfcia/quintela/work/kernel/exclude work/include/linux/smp_lock.h testing/include/linux/smp_lock.h
--- work/include/linux/smp_lock.h Sun May 14 20:20:41 2000
+++ testing/include/linux/smp_lock.h Mon May 15 00:00:29 2000
@@ -5,6 +5,11 @@
#ifndef CONFIG_SMP
+/* We can hold the big kernel lock while we sleep. The scheduler
+ * drops the lock while we sleep and re-acquires it when we are
+ * rescheduled.
+ */
+
#define lock_kernel() do { } while(0)
#define unlock_kernel() do { } while(0)
#define release_kernel_lock(task, cpu) do { } while(0)
--
In theory, practice and theory are the same, but in practice they
are different -- Larry McVoy
--
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.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Helding the Kernel lock while doing IO???
2000-05-06 1:30 Helding the Kernel lock while doing IO??? Juan J. Quintela
2000-05-06 1:34 ` Helding the Kernel lock while doing IO??? (take 2) Juan J. Quintela
2000-05-06 11:48 ` Helding the Kernel lock while doing IO??? Stephen C. Tweedie
@ 2000-05-06 13:16 ` Andrea Arcangeli
2 siblings, 0 replies; 5+ messages in thread
From: Andrea Arcangeli @ 2000-05-06 13:16 UTC (permalink / raw)
To: Juan J. Quintela; +Cc: linux-mm, linux-kernel, Linus Torvalds
On 6 May 2000, Juan J. Quintela wrote:
>I am losing some detail?
kernel lock is released by schedule(). (the only problem of swapin are the
races with swapoff)
>diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* --exclude=TAGS pre7-6/ipc/shm.c testing2/ipc/shm.c
>--- pre7-6/ipc/shm.c Fri May 5 23:58:56 2000
>+++ testing2/ipc/shm.c Sat May 6 02:39:17 2000
>@@ -1379,10 +1379,11 @@
> if (!page) {
> lock_kernel();
> swapin_readahead(entry);
>- page = read_swap_cache(entry);
>+ page = read_swap_cache_async(entry, 0);
> unlock_kernel();
> if (!page)
> goto oom;
>+ wait_on_page(page);
> }
> delete_from_swap_cache(page);
> page = replace_with_highmem(page);
>diff -u -urN --exclude=CVS --exclude=*~ --exclude=.#* --exclude=TAGS pre7-6/mm/memory.c testing2/mm/memory.c
>--- pre7-6/mm/memory.c Fri May 5 23:58:56 2000
>+++ testing2/mm/memory.c Sat May 6 02:02:53 2000
>@@ -1038,11 +1038,10 @@
> if (!page) {
> lock_kernel();
> swapin_readahead(entry);
>- page = read_swap_cache(entry);
>+ page = read_swap_cache_async(entry, 0);
> unlock_kernel();
> if (!page)
> return -1;
>-
> flush_page_to_ram(page);
> flush_icache_page(vma, page);
> }
The above patch would break swapin.
Andrea
--
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.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2000-05-14 22:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-06 1:30 Helding the Kernel lock while doing IO??? Juan J. Quintela
2000-05-06 1:34 ` Helding the Kernel lock while doing IO??? (take 2) Juan J. Quintela
2000-05-06 11:48 ` Helding the Kernel lock while doing IO??? Stephen C. Tweedie
2000-05-14 22:02 ` PATCH: " Juan J. Quintela
2000-05-06 13:16 ` Andrea Arcangeli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox