Re: [PATCH] SCSI: Remove redundant GFP_KERNEL type flag inkmalloc().

From: Andrew Morton
Date: Fri May 04 2007 - 04:16:43 EST



Please be careful to add the appropriate cc's.

On Mon, 30 Apr 2007 04:37:22 -0400 (EDT) "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> wrote:

>
> Remove the apparently redundant GFP_KERNEL type flag in the call to
> kmalloc().
>
> Signed-off-by: Robert P. J. Day <rpjday@xxxxxxxxxxxxxx>
>
> ---
>
> diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
> index a988d5a..765ded0 100644
> --- a/drivers/scsi/aic7xxx_old.c
> +++ b/drivers/scsi/aic7xxx_old.c
> @@ -6581,7 +6581,7 @@ aic7xxx_slave_alloc(struct scsi_device *SDptr)
> struct aic7xxx_host *p = (struct aic7xxx_host *)SDptr->host->hostdata;
> struct aic_dev_data *aic_dev;
>
> - aic_dev = kmalloc(sizeof(struct aic_dev_data), GFP_ATOMIC | GFP_KERNEL);
> + aic_dev = kmalloc(sizeof(struct aic_dev_data), GFP_ATOMIC);

No, this converts the allocation from a robust one which can sleep into a
flakey one which cannot.

If we want to just clean this code up, we should switch to

GFP_KERNEL|__GFP_HIGH

and add a comment explaining why we're turning on __GFP_HIGH (pointlessly,
I suspect).

However I suspect what the code really meant to do was to use just
GFP_KERNEL. It's been that way since

commit 5c9342ceb292ac5c619db6eef4ef427a64bcd436
Author: torvalds <torvalds>
Date: Thu Nov 7 04:54:32 2002 +0000

Merge bk://linux-scsi.bkbits.net/scsi-dledford
into home.transmeta.com:/home/torvalds/v2.5/linux

2002/11/06 16:40:20-05:00 dledford
aic7xxx_old: multiple updates and fixes, driver ported to scsi
mid-layer new error handling scheme
-
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/