Re: [uml-devel] Re: [PATCH 12/16] UML - Memory hotplug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 05, 2006 at 03:02:46PM -0700, Daniel Phillips wrote:
> > page = alloc_page(GFP_ATOMIC);
> 
> A slightly different objection than Andrew's: this will rapidly eat up
> all the pages available for, e.g., receiving network packets, probably
> not what you want.  How about flags=0?  This will dip a little way into
> reserves but not as far as interrupts or realtime tasks, and will not
> attempt any reclaim.  (Maybe we should have a GFP define for that.)

Yeah, it's a bit non-obvious what 0 means in the twisty little maze of
GFP_ flags.

However, I do want to push the system into reclaim later.  It looks
like the only difference between 0 and GFP_ATOMIC is the use of
emergency pools, which I don't really want to exercise anyway.

> > INIT_LIST_HEAD(&unplugged->list);
> > list_add(&unplugged->list, &unplugged_pages);
> 
> You don't need to initialize the list element you are adding.

This look OK to you?

Index: linux-2.6.16/arch/um/drivers/mconsole_kern.c
===================================================================
--- linux-2.6.16.orig/arch/um/drivers/mconsole_kern.c	2006-04-03 18:05:29.000000000 -0400
+++ linux-2.6.16/arch/um/drivers/mconsole_kern.c	2006-04-05 22:54:17.000000000 -0400
@@ -87,7 +87,11 @@ static irqreturn_t mconsole_interrupt(in
 		if(req.cmd->context == MCONSOLE_INTR)
 			(*req.cmd->handler)(&req);
 		else {
-			new = kmalloc(sizeof(*new), GFP_ATOMIC);
+			/* 0 means don't wait (like GFP_ATOMIC) and
+			 * don't dip into emergency pools (unlike
+			 * GFP_ATOMIC).
+			 */
+			new = kmalloc(sizeof(*new), 0);
 			if(new == NULL)
 				mconsole_reply(&req, "Out of memory", 1, 0);
 			else {
@@ -415,7 +419,6 @@ static int mem_config(char *str)
 
 			unplugged = page_address(page);
 			if(unplug_index == UNPLUGGED_PER_PAGE){
-				INIT_LIST_HEAD(&unplugged->list);
 				list_add(&unplugged->list, &unplugged_pages);
 				unplug_index = 0;
 			}
@@ -655,7 +658,6 @@ static void with_console(struct mc_reque
 	struct mconsole_entry entry;
 	unsigned long flags;
 
-	INIT_LIST_HEAD(&entry.list);
 	entry.request = *req;
 	list_add(&entry.list, &clients);
 	spin_lock_irqsave(&console_lock, flags);

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux