linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Ingo Molnar <mingo@elte.hu>, Rik van Riel <riel@conectiva.com.br>,
	Roger Larsson <roger.larsson@norran.net>,
	MM mailing list <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch] vmfixes-2.4.0-test9-B2
Date: Mon, 25 Sep 2000 03:31:28 +0200	[thread overview]
Message-ID: <20000925033128.A10381@athlon.random> (raw)
In-Reply-To: <Pine.LNX.4.10.10009241646560.974-100000@penguin.transmeta.com>; from torvalds@transmeta.com on Sun, Sep 24, 2000 at 05:09:40PM -0700

On Sun, Sep 24, 2000 at 05:09:40PM -0700, Linus Torvalds wrote:
> [..] as with the
> shm_swap() thing this is probably something we do want to fix eventually.

both shm_swap and regular rw_swap_cache have the same deadlock problematic
w.r.t. __GFP_IO. We could do that on a raw device, but if we swap on top of the
filesystem then we could have deadlock problems again.  Really since with the
swapfile blocks are just allocated with ext2 we should not deadlock (but maybe
some other fs have a lock_super in the get_block path anyway). Thus it's safer
not to swapout anything when __GFP_IO is not set.

Also some linux/net/* code is using (or better abusing since __GFP_IO
originally was only meant as a deadlock avoidance thing not a thing
to only shrink the clean cache) GFP_BUFFER to not block (so actually
we would hurt networking too by causing _any_ kind of block in a GFP_BUFFER
allocation).

It would been better to introduce a new flag for allocations that must not
block for latency requirements but that wants still to shrink the clean cache
(instead of finishing the atomic queue). This is trivially fixable grepping
for GFP_BUFFER.

> The icache shrinker probably has similar problems with clear_inode.

Yep. And it sure does blocking I/O because it have to sync the dirty
inodes.

> I suspect that it might be a good idea to try to fix this issue, because
> it will probably keep coming up otherwise. And it's likely to be fairly
> easily debugged, by just making getblk() have some debugging code that
> basically says something like
> 
> 	lock_super()
> 	{
> 		.. do the lock ..
> +		current->super_locked++;
> 	}
> 
> 	unlock_super()
> 	{
> +		if (current->super_locked < 1)
> +			BUG();
> +		current->super_locked--;
> 		.. do the unlock ..
> 	}
> 
> 	getblk()
> 	{
> +		if (current->super_locked)
> +			BUG();
> 		.. do the getblk ..
> 	}

BTW (running offtopic), I collected such information in 2.2.x too (but for
another reason).

	ftp://ftp.us.kernel.org/pub/linux/kernel/people/andrea/patches/v2.2/2.2.18pre9/VM-global-2.2.18pre9-6.bz2

I trapped all the down on the inode semaphore in the same way (I called it
current->fs_locks for both down and superlock).

I'm using such information to know if there's any lock held in the context
of the task to know if I can do I/O or not without risking to deadlock
on any inode semaphore or on any superblock lock.

With that change I could then also use GFP_KERNEL in getblk in 2.2.x (I admit
at first I did that :), but then I preferred to stay on the safe side
for things like loop that _have_ to work in 2.2.x :).

So now we know when we can writepage a dirty MAP_SHARED page in swap_out and we
do it from the task that is trying to allocate memory, so the task that is
trying to allocate memory will block waiting some dirty buffer to be written in
writepage->wakeup_bdflush(1).

In 2.2.x (as we do in 2.4.x) we _need_ to writeout the page ourself from
swapout (not async queueing into kpiod) because kpiod is completly asynchrous
and so without this change GFP was returning, we was allocating memory again,
and we was entering GFP again, all at fast rate.  In the meantime kpiod was
still blocked in mark_buffer_dirty->wakeup_bdflush(1) and then the tasks
allocating memory (who thought to have done some progress because it queued
many pages into kpiod) was getting killed.

Of course then I also killed kpiod since it wasn't necessary anymore and now
MAP_SHARED semgments doesn't kill tasks anymore.

> and just making it a new rule that you cannot call getblk() with any locks
> held.

Yes I see it would certainly trap the deadlock cases.

> (the superblock lock is quite contended right now, and the reason for that

Right (on large fs is going to be quite painful for scalability) and the
BUG would have the benefit of partly solving it.

I'm thinking that dropping the superblock lock completly wouldn't be much more
difficult than this mid stage.  The only cases where we block in critical
sections protected by the superblock lock is in getblk/bread (bread calls
getblk) and ll_rw_block and mark_buffer_dirty.  Once we drop the lock for the
first cases it should not be more difficult to drop it completly.

Not sure if this is the right moment for those changes though, I'm not worried
about ext2 but about the other non-netoworked fses that nobody uses regularly.

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/

  parent reply	other threads:[~2000-09-25  1:31 UTC|newest]

Thread overview: 243+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-24 10:11 __GFP_IO && shrink_[d|i]cache_memory()? Ingo Molnar
2000-09-24 18:11 ` Linus Torvalds
2000-09-24 18:40   ` Ingo Molnar
2000-09-24 18:39     ` Linus Torvalds
2000-09-24 18:46       ` Linus Torvalds
2000-09-24 18:59         ` Ingo Molnar
2000-09-24 19:34         ` [patch] vmfixes-2.4.0-test9-B2 Ingo Molnar
2000-09-24 20:20           ` Rui Sousa
2000-09-24 20:24           ` Andrea Arcangeli
2000-09-24 20:26             ` Ingo Molnar
2000-09-24 21:12               ` Andrea Arcangeli
2000-09-24 21:12                 ` Ingo Molnar
2000-09-24 21:43                   ` Stephen C. Tweedie
2000-09-24 22:13                     ` Andrea Arcangeli
2000-09-24 22:36                       ` [patch] vmfixes-2.4.0-test9-B2 - fixing deadlocks bert hubert
2000-09-24 23:41                         ` Andrea Arcangeli
2000-09-25 16:24                           ` Stephen C. Tweedie
2000-09-25 17:03                             ` Andrea Arcangeli
2000-09-25 18:06                               ` Stephen C. Tweedie
2000-09-25 19:32                                 ` Andrea Arcangeli
2000-09-25 19:26                                   ` Rik van Riel
2000-09-25 22:28                                     ` Andrea Arcangeli
2000-09-25 22:26                                       ` Rik van Riel
2000-09-25 22:51                                         ` Andrea Arcangeli
2000-09-25 22:30                                       ` Linus Torvalds
2000-09-25 23:03                                         ` Andrea Arcangeli
2000-09-25 23:18                                           ` Linus Torvalds
2000-09-26  0:32                                             ` Andrea Arcangeli
2000-09-25 22:30                                       ` Juan J. Quintela
2000-09-25 23:00                                         ` Andrea Arcangeli
2000-09-25 19:54                                   ` Stephen C. Tweedie
2000-09-25 22:44                                     ` Andrea Arcangeli
2000-09-25 22:42                                       ` Rik van Riel
2000-09-26  6:54                                     ` Christoph Rohland
2000-09-26 14:05                                       ` Andrea Arcangeli
2000-09-26 16:20                                         ` Christoph Rohland
2000-09-26 17:10                                           ` Andrea Arcangeli
2000-09-27  8:11                                             ` Christoph Rohland
2000-09-27  8:28                                               ` Ingo Molnar
2000-09-27  9:24                                                 ` Christoph Rohland
2000-09-27 13:56                                               ` Andrea Arcangeli
2000-09-27 16:56                                                 ` Christoph Rohland
2000-09-27 17:42                                                   ` Andrea Arcangeli
2000-09-27 18:25                                                     ` Erik Andersen
2000-09-27 18:55                                                       ` Andrea Arcangeli
2000-09-28 10:08                                                 ` Rik van Riel
2000-09-28 11:16                                                   ` Rik van Riel
2000-09-28 14:52                                                     ` Andrea Arcangeli
2000-09-29 14:39                                                       ` Rik van Riel
2000-09-29 14:55                                                         ` Andrea Arcangeli
2000-09-29 15:40                                                           ` Rik van Riel
2000-09-28 11:31                                                   ` Ingo Molnar
2000-09-28 14:54                                                     ` Andrea Arcangeli
2000-09-28 15:13                                                       ` Ingo Molnar
2000-09-28 15:23                                                         ` Andrea Arcangeli
2000-09-28 16:16                                                         ` Juan J. Quintela
2000-09-28 14:31                                                   ` Andrea Arcangeli
2000-09-25 17:21                           ` bert hubert
2000-09-25 17:49                             ` Andrea Arcangeli
2000-09-25 15:09                         ` Miles Lane
2000-09-25 15:51                         ` Stephen C. Tweedie
2000-09-25 16:05                           ` Ingo Molnar
2000-09-25 16:06                             ` Alexander Viro
2000-09-25 16:20                               ` Ingo Molnar
2000-09-25 16:29                                 ` Andrea Arcangeli
2000-09-25  4:56                   ` [patch] vmfixes-2.4.0-test9-B2 Linus Torvalds
2000-09-25  5:19                     ` Alexander Viro
2000-09-25  6:06                       ` Linus Torvalds
2000-09-25  6:17                         ` Alexander Viro
2000-09-25 21:21                         ` Alexander Viro
2000-09-26 13:42                       ` [CFT][PATCH] ext2 directories in pagecache Alexander Viro
2000-09-26 21:29                       ` Alexander Viro
2000-09-26 22:16                         ` Marko Kreen
2000-09-26 22:31                           ` Alexander Viro
2000-09-26 22:47                             ` Marko Kreen
2000-09-27  7:32                               ` Ingo Molnar
2000-09-27  9:22                                 ` Alexander Viro
2000-09-26 23:19                         ` Andreas Dilger
2000-09-26 23:33                           ` Alexander Viro
2000-09-26 23:44                             ` Alexander Viro
2000-09-25  0:09                 ` [patch] vmfixes-2.4.0-test9-B2 Linus Torvalds
2000-09-25  0:49                   ` Alexander Viro
2000-09-25  0:53                   ` Marcelo Tosatti
2000-09-25  1:45                     ` Andrea Arcangeli
2000-09-25  2:39                       ` Marcelo Tosatti
2000-09-25 15:36                         ` Andrea Arcangeli
2000-09-25 10:42                     ` the new VM Ingo Molnar
2000-09-25 13:02                       ` Andrea Arcangeli
2000-09-25 13:02                         ` Ingo Molnar
2000-09-25 13:08                           ` Andrea Arcangeli
2000-09-25 13:12                             ` Ingo Molnar
2000-09-25 13:30                               ` Andrea Arcangeli
2000-09-25 13:39                                 ` Ingo Molnar
2000-09-25 14:04                                   ` Andrea Arcangeli
2000-09-25 14:04                                     ` Ingo Molnar
2000-09-25 14:23                                       ` Andrea Arcangeli
2000-09-25 14:27                                         ` Ingo Molnar
2000-09-25 14:39                                           ` Andrea Arcangeli
2000-09-25 14:43                                             ` Ingo Molnar
2000-09-25 15:01                                               ` Andrea Arcangeli
2000-09-25 15:10                                                 ` Ingo Molnar
2000-09-25 15:24                                                   ` Andrea Arcangeli
2000-09-25 15:26                                                     ` Ingo Molnar
2000-09-25 15:22                                                       ` yodaiken
2000-09-26 19:10                                                 ` Pavel Machek
2000-09-26 20:16                                                   ` Andrea Arcangeli
2000-09-27  7:42                                                   ` Ingo Molnar
2000-09-27 12:11                                                     ` yodaiken
2000-09-27 14:08                                                     ` Andrea Arcangeli
2000-09-25 16:09                                             ` Rik van Riel
2000-09-25 14:26                                     ` Marcelo Tosatti
2000-09-25 14:50                                       ` Andrea Arcangeli
2000-09-25 14:47                               ` Alan Cox
2000-09-25 15:16                                 ` Ingo Molnar
2000-09-25 15:16                                   ` the new VMt Alan Cox
2000-09-25 15:33                                     ` the new VM Ingo Molnar
2000-09-25 15:41                                     ` the new VMt Andrea Arcangeli
2000-09-25 16:02                                       ` Ingo Molnar
2000-09-25 16:04                                         ` Andi Kleen
2000-09-25 16:19                                           ` Ingo Molnar
2000-09-25 16:18                                             ` Andi Kleen
2000-09-25 16:41                                               ` Andrea Arcangeli
2000-09-25 16:35                                                 ` Linus Torvalds
2000-09-25 16:41                                                   ` Rik van Riel
2000-09-25 16:49                                                     ` Linus Torvalds
2000-09-25 17:03                                                       ` Ingo Molnar
2000-09-25 17:17                                                         ` Andrea Arcangeli
2000-09-25 17:10                                                           ` Rik van Riel
2000-09-25 17:27                                                             ` Andrea Arcangeli
2000-09-25 17:15                                                       ` Andrea Arcangeli
2000-09-27  7:14                                                   ` Rusty Russell
2000-09-25 20:23                                               ` Russell King
2000-09-25 16:28                                             ` Rik van Riel
2000-09-25 16:11                                         ` Andrea Arcangeli
2000-09-25 16:22                                           ` Ingo Molnar
2000-09-25 16:17                                             ` Alexander Viro
2000-09-25 16:36                                               ` Jeff Garzik
2000-09-25 16:57                                               ` Alan Cox
2000-09-25 17:01                                                 ` Alexander Viro
2000-09-25 17:06                                                   ` Alan Cox
2000-09-25 17:31                                                     ` Oliver Xymoron
2000-09-25 17:51                                                       ` Jeff Garzik
2000-09-25 19:03                                                     ` the new VMt [4MB+ blocks] Matti Aarnio
2000-09-25 20:02                                                       ` Stephen Williams
2000-09-25 16:33                                             ` the new VMt Andrea Arcangeli
2000-09-26  8:38                                             ` Jes Sorensen
2000-09-26  8:52                                               ` Ingo Molnar
2000-09-26  9:02                                                 ` Jes Sorensen
2000-09-25 16:53                                         ` Alan Cox
2000-09-25 15:42                                     ` Stephen C. Tweedie
2000-09-25 16:05                                       ` Andrea Arcangeli
2000-09-25 16:22                                         ` Rik van Riel
2000-09-25 16:42                                           ` Andrea Arcangeli
2000-09-25 17:39                                         ` Stephen C. Tweedie
2000-09-25 16:51                                       ` Alan Cox
2000-09-25 17:43                                         ` Stephen C. Tweedie
2000-09-25 18:13                                           ` Alan Cox
2000-09-25 18:21                                             ` Stephen C. Tweedie
2000-09-25 19:09                                               ` Alan Cox
2000-09-25 19:21                                                 ` Stephen C. Tweedie
2000-09-25 16:52                                       ` yodaiken
2000-09-25 17:18                                         ` Jamie Lokier
2000-09-25 17:51                                           ` yodaiken
2000-09-25 18:04                                             ` Jamie Lokier
2000-09-25 18:13                                               ` yodaiken
2000-09-25 18:24                                                 ` Stephen C. Tweedie
2000-09-25 18:34                                                   ` yodaiken
2000-09-25 18:48                                                     ` Jamie Lokier
2000-09-25 19:25                                                     ` Stephen C. Tweedie
2000-09-25 20:04                                                       ` yodaiken
2000-09-25 20:23                                                         ` Alan Cox
2000-09-25 20:35                                                           ` yodaiken
2000-09-25 20:46                                                             ` Alan Cox
2000-09-25 21:07                                                               ` yodaiken
2000-09-26  9:54                                                                 ` Stephen C. Tweedie
2000-09-26 13:17                                                                   ` yodaiken
2000-09-25 20:47                                                             ` Benjamin C.R. LaHaise
2000-09-25 21:12                                                               ` yodaiken
2000-09-26 10:07                                                                 ` Stephen C. Tweedie
2000-09-26 13:30                                                                   ` yodaiken
2000-09-25 20:32                                                         ` Stephen C. Tweedie
2000-09-26 12:10                                                           ` Mark Hemment
2000-09-27 10:13                                                             ` Andrey Savochkin
2000-09-27 12:55                                                               ` Hugh Dickins
2000-09-28  3:25                                                                 ` Andrey Savochkin
2000-09-25 23:14                                                         ` Erik Andersen
2000-09-26 15:17                                                           ` yodaiken
2000-09-26 16:04                                                             ` Stephen C. Tweedie
2000-09-26 17:02                                                               ` Erik Andersen
2000-09-26 17:08                                                                 ` Stephen C. Tweedie
2000-09-26 17:45                                                                   ` Erik Andersen
2000-09-27 10:20                                                                     ` Andrey Savochkin
2000-09-26 21:13                                                                   ` Eric Lowe
2000-09-25 18:20                                             ` Andrea Arcangeli
2000-09-25 16:16                                     ` Rik van Riel
2000-09-25 16:55                                       ` Alan Cox
2000-09-25 15:48                                   ` the new VM Andrea Arcangeli
2000-09-25 15:40                                 ` Stephen C. Tweedie
2000-09-25 16:01                                   ` Andrea Arcangeli
2000-09-25 14:37                             ` Rik van Riel
2000-09-25 20:34                               ` Christoph Rohland
2000-10-06 16:14                                 ` Rik van Riel
2000-10-09  7:37                                   ` Christoph Rohland
2000-09-25 13:04                         ` Ingo Molnar
2000-09-25 13:19                           ` Andrea Arcangeli
2000-09-25 13:18                             ` Ingo Molnar
2000-09-25 13:21                             ` Ingo Molnar
2000-09-25 13:31                               ` Andrea Arcangeli
2000-09-25 13:47                                 ` Ingo Molnar
2000-09-25 14:04                                   ` Andrea Arcangeli
2000-09-25  1:31                   ` Andrea Arcangeli [this message]
2000-09-25  1:27                     ` [patch] vmfixes-2.4.0-test9-B2 Alexander Viro
2000-09-25  2:02                       ` Andrea Arcangeli
2000-09-25  2:01                         ` Alexander Viro
2000-09-25 13:47                         ` Stephen C. Tweedie
2000-09-25 10:13                     ` Ingo Molnar
2000-09-25 12:58                       ` Andrea Arcangeli
2000-09-25 13:10                         ` Ingo Molnar
2000-09-25 13:49                           ` Jens Axboe
2000-09-25 14:11                             ` Ingo Molnar
2000-09-25 14:05                               ` Jens Axboe
2000-09-25 16:46                               ` Linus Torvalds
2000-09-25 17:05                                 ` Ingo Molnar
2000-09-25 17:23                                   ` Andrea Arcangeli
2000-09-25 14:20                             ` Andrea Arcangeli
2000-09-25 14:11                               ` Jens Axboe
2000-09-25 14:33                                 ` Andrea Arcangeli
2000-09-25 13:56                           ` Andrea Arcangeli
2000-09-25 13:57                             ` Ingo Molnar
2000-09-25 14:13                               ` Andrea Arcangeli
2000-09-25 14:08                                 ` Jens Axboe
2000-09-25 14:29                                   ` Andrea Arcangeli
2000-09-25 14:18                                     ` Jens Axboe
2000-09-25 14:47                                       ` Andrea Arcangeli
2000-09-25 21:28                                         ` Jens Axboe
2000-09-25 22:14                                           ` Andrea Arcangeli
2000-09-25 14:13                                 ` Ingo Molnar
2000-09-25 14:29                                 ` Ingo Molnar
2000-09-25 14:46                                   ` Andrea Arcangeli
2000-09-25 14:53                                     ` Ingo Molnar
2000-09-25 15:02                                       ` Andrea Arcangeli
2000-09-24 21:38     ` __GFP_IO && shrink_[d|i]cache_memory()? Stephen C. Tweedie
2000-09-24 23:20       ` Alan Cox

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=20000925033128.A10381@athlon.random \
    --to=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=riel@conectiva.com.br \
    --cc=roger.larsson@norran.net \
    --cc=torvalds@transmeta.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