Re: [PATCH] scsi: fix sense_slab/bio swapping livelock

From: Linus Torvalds
Date: Mon Apr 07 2008 - 17:17:48 EST




On Tue, 8 Apr 2008, Pekka Enberg wrote:
>
> I wonder if we can get away with a SLAB_IO flag that you can use to annotate
> caches that participate in writeout and the allocator could keep some spare
> pages around that can be handed out for them in case of OOM...

Actually, I don't think this is SLAB-specific, since there are potentially
the same issues for pages.

I suspect the right thing to do is not to mark them for "IO", but mark
them for "short-lived", and allow short-lived allocations that don't have
extended lifetimes to succeed even when a "real" allocation wouldn't.

When we are under memory pressure, a normal allocation generally needs to
clear up enough memory from elsewhere to succeed. But a short-lived
allocation without any long-term lifetimes would be known to release its
memory back to the pool, so it can be allowed to go ahead when a normal
memory allocation would not.

Examples of short-lived allocations:
- IO requests
- temporary network packets that don't get queued up (eg "ACK" packet) as
opposed to those that do get queued (incoming _or_ outgoing queues)
- things like the temporary buffers for "getname()/putname()" etc.

That said, even a lot of temporary allocations can at times have issues.
If your IO layer is dead, your IO request queues that _should_ have been
very temporary may end up staying around for a long time. But I do think
that it makes sense to prioritize allocations that are known to be short-
lived.

(It might also allows us to allocate them from different pools and just
generally have other heuristics for cache behaviour - short-lived
allocations simply have different behaviour)

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/