Re: Question about OOM-Killer

Martin J. Bligh
2005-07-26T16:34:15Z

--Andi Kleen <ak@muc.de> wrote (on Tuesday, July 26, 2005 17:17:54 +0200):

>> But that's really for ISA DMA, which nobody uses any more apart from the
>> floppy disk, and the stone-tablet adaptor. For now, I'm guessing that if
>> you remove that __GFP_DMA, your machine will be happier, but it's not
>> the right fix.
>
> iirc the reason for that was that someone could load an old ISA SCSI controller
> later as a module and it needs to handle that. Perhaps make it dependent
> on CONFIG_ISA ? But even that would not help on distribution kernels.
> Another way would be to check in PCI systems if there is a ISA
> bridge and for others assume ISA is there.

Yeah, the CONFIG_ISA thing makes a lot of sense to me ... however, would
be even better if we can work out (easily) what the disk is attatched to.
Pah, ISA is so shit. Generically, might be useful if we had a
__GFP_DMA_IF_ISA or something defined in the header files, rather than
just shoving ifdef's all over the place.

OTOH, Jim is right ... the OOM killer is being somewhat psycopathic. Seems
we need 2 fixes ;-)

M.

PS. Warning, this is wholly untested, and generally a bit shit.
PPS. jejb ... your mail bounces.

diff -aurpN -X /home/fletch/.diff.exclude virgin/drivers/scsi/sd.c isa_dma/drivers/scsi/sd.c
--- virgin/drivers/scsi/sd.c 2005-07-26 09:25:40.000000000 -0700
+++ isa_dma/drivers/scsi/sd.c 2005-07-26 09:32:05.000000000 -0700
@@ -1468,7 +1468,7 @@ static int sd_revalidate_disk(struct gen
goto out;
}

- buffer = kmalloc(512, GFP_KERNEL | __GFP_DMA);
+ buffer = kmalloc(512, GFP_KERNEL | __GFP_DMA_IF_ISA);
if (!buffer) {
printk(KERN_WARNING "(sd_revalidate_disk:) Memory allocation "
"failure.\n");
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/linux/gfp.h isa_dma/include/linux/gfp.h
--- virgin/include/linux/gfp.h 2005-07-26 09:26:02.000000000 -0700
+++ isa_dma/include/linux/gfp.h 2005-07-26 09:29:38.000000000 -0700
@@ -13,6 +13,11 @@ struct vm_area_struct;
*/
/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
#define __GFP_DMA 0x01
+#ifdef CONFIG_ISA
+ #define __GFP_DMA_IF_ISA __GFP_DMA
+#else
+ #define __GFP_DMA_IF_ISA 0
+#endif
#define __GFP_HIGHMEM 0x02

/*