[PATCH] perthread_pages_alloc cleanup

From: Martin Hicks (mort_at_wildopensource.com)
Date: 02/28/05

  • Next message: Payasam Manohar: "user space program from keyboard driver"
    Date:	Mon, 28 Feb 2005 10:52:48 -0500
    To: Andrew Morton <akpm@osdl.org>
    
    

    Hi Andrew,

    This is just a cleanup - no functional changes. Gets a bunch of code
    outside an if by returning NULL earlier.

    -- 
    Martin Hicks                Wild Open Source Inc.
    mort@wildopensource.com     613-266-2296
    Signed-Off-By: Martin Hicks <mort@wildopensource.com>
    Index: linux-2.6.10/mm/page_alloc.c
    ===================================================================
    --- linux-2.6.10.orig/mm/page_alloc.c	2005-02-25 08:02:33.000000000 -0800
    +++ linux-2.6.10/mm/page_alloc.c	2005-02-28 07:08:01.000000000 -0800
    @@ -710,6 +710,7 @@
     perthread_pages_alloc(void)
     {
     	struct list_head *perthread_pages;
    +	struct page *page;
     
     	/*
     	 * try to allocate pages from the per-thread private_pages pool. No
    @@ -717,18 +718,16 @@
     	 * itself, and not by interrupts or other threads.
     	 */
     	perthread_pages = get_per_thread_pages();
    -	if (!in_interrupt() && !list_empty(perthread_pages)) {
    -		struct page *page;
    -
    -		page = list_entry(perthread_pages->next, struct page, lru);
    -		list_del(&page->lru);
    -		current->private_pages_count--;
    -		/*
    -		 * per-thread page is already initialized, just return it.
    -		 */
    -		return page;
    -	} else
    +	if (in_interrupt() || list_empty(perthread_pages))
     		return NULL;
    +
    +	page = list_entry(perthread_pages->next, struct page, lru);
    +	list_del(&page->lru);
    +	current->private_pages_count--;
    +	/*
    +	 * per-thread page is already initialized, just return it.
    +	 */
    +	return page;
     }
     
     /*
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Payasam Manohar: "user space program from keyboard driver"

    Relevant Pages

    • Re: [PATCH] perthread_pages_alloc cleanup
      ... > This is just a cleanup - no functional changes. ... Gets a bunch of code ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Linux in a binary world... a doomsday scenario
      ... bunch of sillyheads. ... unlikely because of positive engineering attributes of open source. ... Smart companies want open source drivers not because people snipe at ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: page migration patchset
      ... That's news to me. ... I do recall some months ago that there were a whole bunch of patches doing ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 2.6] ToPIC specific init for yenta_socket
      ... > coherent code is normally easier to fix than a bunch of different hacks. ... and I'm going to fix them as part of my present work. ... have two different cardbus controllers in the same machine. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 1/2] kthread_create
      ... > Expand task_struct for this one usage? ... > This means that threads can exit without having to do cleanup. ... plus eventually a spinlock) of the task struct. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)