* set_page_dirty/page_launder deadlock
@ 2001-01-14 3:21 Marcelo Tosatti
2001-01-14 13:27 ` David S. Miller
0 siblings, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2001-01-14 3:21 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel
Hi,
While taking a look at page_launder()...
/* And re-start the thing.. */
spin_lock(&pagemap_lru_lock); <----------
if (result != 1)
continue;
/* writepage refused to do anything */
set_page_dirty(page);
^^^^^^^^^^^^^^^^^^^^
goto page_active;
}
set_page_dirty() may lock the pagecache_lock which means potential
deadlock since we have the pagemap_lru_lock locked.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: set_page_dirty/page_launder deadlock
2001-01-14 3:21 set_page_dirty/page_launder deadlock Marcelo Tosatti
@ 2001-01-14 13:27 ` David S. Miller
2001-01-14 18:56 ` Linus Torvalds
0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2001-01-14 13:27 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Linus Torvalds, linux-kernel
Marcelo Tosatti writes:
>
> While taking a look at page_launder()...
...
> set_page_dirty() may lock the pagecache_lock which means potential
> deadlock since we have the pagemap_lru_lock locked.
Indeed, the following should work as a fix:
--- mm/vmscan.c.~1~ Thu Jan 11 02:22:19 2001
+++ mm/vmscan.c Sun Jan 14 05:26:17 2001
@@ -493,12 +493,15 @@
page_cache_release(page);
/* And re-start the thing.. */
- spin_lock(&pagemap_lru_lock);
- if (result != 1)
+ if (result != 1) {
+ spin_lock(&pagemap_lru_lock);
continue;
- /* writepage refused to do anything */
- set_page_dirty(page);
- goto page_active;
+ } else {
+ /* writepage refused to do anything */
+ set_page_dirty(page);
+ spin_lock(&pagemap_lru_lock);
+ goto page_active;
+ }
}
/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: set_page_dirty/page_launder deadlock
2001-01-14 13:27 ` David S. Miller
@ 2001-01-14 18:56 ` Linus Torvalds
2001-01-17 19:57 ` Chris Mason
2001-01-19 17:44 ` Christoph Rohland
0 siblings, 2 replies; 6+ messages in thread
From: Linus Torvalds @ 2001-01-14 18:56 UTC (permalink / raw)
To: David S. Miller; +Cc: Marcelo Tosatti, linux-kernel
On Sun, 14 Jan 2001, David S. Miller wrote:
>
> Marcelo Tosatti writes:
> >
> > While taking a look at page_launder()...
>
> ...
>
> > set_page_dirty() may lock the pagecache_lock which means potential
> > deadlock since we have the pagemap_lru_lock locked.
>
> Indeed, the following should work as a fix:
Well, as the new shm code doesn't return 1 any more, the whole locked page
handling should just be deleted. ramfs always just re-marked the page
dirty in its own "writepage()" function, so it was only shmfs that ever
returned this special case, and because of other issues it already got
excised by Christoph..
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: set_page_dirty/page_launder deadlock
2001-01-14 18:56 ` Linus Torvalds
@ 2001-01-17 19:57 ` Chris Mason
2001-01-19 17:44 ` Christoph Rohland
1 sibling, 0 replies; 6+ messages in thread
From: Chris Mason @ 2001-01-17 19:57 UTC (permalink / raw)
To: Linus Torvalds, David S. Miller; +Cc: Marcelo Tosatti, linux-kernel
On Sunday, January 14, 2001 10:56:10 AM -0800 Linus Torvalds
<torvalds@transmeta.com> wrote:
>> Marcelo Tosatti writes:
>> >
>> > While taking a look at page_launder()...
>>
>> ...
>>
>> > set_page_dirty() may lock the pagecache_lock which means potential
>> > deadlock since we have the pagemap_lru_lock locked.
>>
>
> Well, as the new shm code doesn't return 1 any more, the whole locked page
> handling should just be deleted. ramfs always just re-marked the page
> dirty in its own "writepage()" function, so it was only shmfs that ever
> returned this special case, and because of other issues it already got
> excised by Christoph..
>
Then I'm confused by the code in 2.4.1pre8:
-chris
/*
* Move the page from the page cache to the swap cache
*/
static int shmem_writepage(struct page * page)
{
int error;
struct shmem_inode_info *info;
swp_entry_t *entry, swap;
info = &page->mapping->host->u.shmem_i;
if (info->locked)
return 1;
swap = __get_swap_page(2);
if (!swap.val)
return 1;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: set_page_dirty/page_launder deadlock
2001-01-14 18:56 ` Linus Torvalds
2001-01-17 19:57 ` Chris Mason
@ 2001-01-19 17:44 ` Christoph Rohland
2001-01-23 18:28 ` Hugh Dickins
1 sibling, 1 reply; 6+ messages in thread
From: Christoph Rohland @ 2001-01-19 17:44 UTC (permalink / raw)
To: Linus Torvalds; +Cc: David S. Miller, Marcelo Tosatti, linux-kernel
Hi Linus,
On Sun, 14 Jan 2001, Linus Torvalds wrote:
> Well, as the new shm code doesn't return 1 any more, the whole
> locked page handling should just be deleted. ramfs always just
> re-marked the page dirty in its own "writepage()" function, so it
> was only shmfs that ever returned this special case, and because of
> other issues it already got excised by Christoph..
No, that's not completely right. There may be rare cases like out of
swap that shmem_write does return 1. But couldn't it simply set the
page dirty like ramfs_writepage?
Greetings
Christoph
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: set_page_dirty/page_launder deadlock
2001-01-19 17:44 ` Christoph Rohland
@ 2001-01-23 18:28 ` Hugh Dickins
0 siblings, 0 replies; 6+ messages in thread
From: Hugh Dickins @ 2001-01-23 18:28 UTC (permalink / raw)
To: Christoph Rohland
Cc: Linus Torvalds, David S. Miller, Marcelo Tosatti, linux-kernel
On 19 Jan 2001, Christoph Rohland wrote:
> On Sun, 14 Jan 2001, Linus Torvalds wrote:
> > Well, as the new shm code doesn't return 1 any more, the whole
> > locked page handling should just be deleted. ramfs always just
> > re-marked the page dirty in its own "writepage()" function, so it
> > was only shmfs that ever returned this special case, and because of
> > other issues it already got excised by Christoph..
>
> No, that's not completely right. There may be rare cases like out of
> swap that shmem_write does return 1. But couldn't it simply set the
> page dirty like ramfs_writepage?
I notice that shmem_writepage() in 2.4.1-pre10 is still doing an
early "return 1" without UnlockPage(page): surely that's wrong?
Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2001-01-23 18:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-14 3:21 set_page_dirty/page_launder deadlock Marcelo Tosatti
2001-01-14 13:27 ` David S. Miller
2001-01-14 18:56 ` Linus Torvalds
2001-01-17 19:57 ` Chris Mason
2001-01-19 17:44 ` Christoph Rohland
2001-01-23 18:28 ` Hugh Dickins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox