From 40ea9a64ebf1f7bd62da177824e61ada5505896b Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 29 Dec 2003 05:43:08 -0800 Subject: [PATCH] [PATCH] Use __GFP_REPEAT for cdrom buffer The cdrom driver does an order-4 allocation and the open will fail if that allocation does not succeed. This happened to me on an unstressed 900MB machine. So add the __GFP_REPEAT flag in there - this will cause the page allocator to keep on freeing pages until the allocation succeeds. It can in theory livelock but in practice I expect it is OK: the user should just stop running dbench or whatever it is which is gobbling all the memory and the mount/open will then succeed. --- drivers/ide/ide-cd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index c332518996efd..5756c5ce99e56 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -3343,7 +3343,8 @@ static int idecd_open(struct inode * inode, struct file * file) drive->usage++; if (!info->buffer) - info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL); + info->buffer = kmalloc(SECTOR_BUFFER_SIZE, + GFP_KERNEL|__GFP_REPEAT); if (!info->buffer || (rc = cdrom_open(&info->devinfo, inode, file))) drive->usage--; return rc; -- 2.53.0