linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: "Stephen C. Tweedie" <sct@redhat.com>
Cc: Rik van Riel <riel@conectiva.com.br>,
	Marcelo Tosatti <marcelo@conectiva.com.br>,
	Jens Axboe <axboe@suse.de>, Alan Cox <alan@redhat.com>,
	Derek Martin <derek@cerberus.ne.mediaone.net>,
	Linux Kernel <linux-kernel@vger.rutgers.edu>,
	linux-mm@kvack.org
Subject: Re: More 2.2.17pre9 VM issues
Date: Mon, 3 Jul 2000 16:56:46 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.21.0007031643100.1375-100000@inspiron.random> (raw)
In-Reply-To: <20000703145642.B3284@redhat.com>

On Mon, 3 Jul 2000, Stephen C. Tweedie wrote:

>That has never been a requirement, and I'd think it would be
>dangerous to make such a new rule so close to 2.4.  

Note that 2.4.0-test* doesn't have kpiod just now (it's been dropped in
the 2.3.x cycle). Here I was wondering only about 2.2.x.

>Certainly, in 2.2 we would do all sorts of stuff while holding
>filesystem locks (in particular the inode and superblock locks).  Any
>file write, including mm page writes, would take the inode lock.  
>
>Right now, in 2.4, the mm locks less but write(2) still takes the
>inode lock.  That means that we _must_ be able to allocate with GFP_IO
>while holding the inode lock, since (a) write()s go through the page
>cache, and (b) touching the user's buffer during the write() can cause

writes in 2.2.x goes through the buffer cache that is for this reason
allocated with GFP_BUFFER.

>pages to be swapped in, invoking parts of the VM which assume they are
>able to use GFP_IO safely.

arghh b is a problem. I could workaround that with per per-process bitflag
set before down(&inode->i_sem) that reminds me not to write on any fs
because I would risk to recurse on the inode->i_sem.

The main problem I have with kpiod is that while it obviously avoids any
kind of deadlocks on the fs since make_pio_request is completly
asynchronous, it also introduces a problem in the swap_out code where we
have no way to know if we did some progress or not and if we should wait
some buffer to be written to disk. Waiting in shrink_mmap isn't even
enough since kpiod could have not yet been started writing and so there
may be none locked or dirty buffer in first place... We can't even wait on
kpiod ala wakeup_bdflush(1) since it would re-introduce the same deadlock
problem making kpiod useless for its anti-deadlock purpose.

So the only sane solution looked to me to skip the filemap_swapout when we
can't do it, and to do it ourselfs when we can. The problem is the "when
we can". Do you think it would be insane to implement the workaround I
mentioned above around the write semaphore?

>Sure, you could audit every single path through every filesystem to
>make sure that there are no possible deadlocks here, but the whole
>point of kpiod is to separate out the pageout from the process doing
>the write() in such situations to make deadlock impossible.

I'll think some more on it.

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/

  reply	other threads:[~2000-07-03 14:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20000703111813.D2699@redhat.com>
     [not found] ` <Pine.LNX.4.21.0007031314190.12740-100000@inspiron.random>
2000-07-03 13:56   ` Stephen C. Tweedie
2000-07-03 14:56     ` Andrea Arcangeli [this message]
2000-07-03 16:09       ` Stephen C. Tweedie

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=Pine.LNX.4.21.0007031643100.1375-100000@inspiron.random \
    --to=andrea@suse.de \
    --cc=alan@redhat.com \
    --cc=axboe@suse.de \
    --cc=derek@cerberus.ne.mediaone.net \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=linux-mm@kvack.org \
    --cc=marcelo@conectiva.com.br \
    --cc=riel@conectiva.com.br \
    --cc=sct@redhat.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