2005-02-28 15:53:12

by Martin Hicks

[permalink] [raw]
Subject: [PATCH] perthread_pages_alloc cleanup


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.
[email protected] 613-266-2296


Signed-Off-By: Martin Hicks <[email protected]>


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;
}

/*


2005-02-28 21:35:18

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] perthread_pages_alloc cleanup

On Mon, Feb 28, 2005 at 10:52:48AM -0500, Martin Hicks wrote:
>
> Hi Andrew,
>
> This is just a cleanup - no functional changes. Gets a bunch of code
> outside an if by returning NULL earlier.

the last discussion of that code had the outcome we should just drop
it, probably not worth wasting any time on it.

2005-02-28 21:45:23

by Martin Hicks

[permalink] [raw]
Subject: Re: [PATCH] perthread_pages_alloc cleanup



On Mon, Feb 28, 2005 at 09:35:09PM +0000, Christoph Hellwig wrote:
> On Mon, Feb 28, 2005 at 10:52:48AM -0500, Martin Hicks wrote:
> >
> > Hi Andrew,
> >
> > This is just a cleanup - no functional changes. Gets a bunch of code
> > outside an if by returning NULL earlier.
>
> the last discussion of that code had the outcome we should just drop
> it, probably not worth wasting any time on it.

Fair enough. I have no idea with regards to the merit of this code.
That detail just bugged me enough to send a patch.

mh

--
Martin Hicks Wild Open Source Inc.
[email protected] 613-266-2296