From: Minchan Kim <minchan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Seth Jennings <sjenning@linux.vnet.ibm.com>,
Nitin Gupta <ngupta@vflare.org>,
Dan Magenheimer <dan.magenheimer@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Minchan Kim <minchan@kernel.org>
Subject: [PATCH 1/4] zsmalloc: rename zspage_order with zspage_pages
Date: Thu, 3 May 2012 15:40:39 +0900 [thread overview]
Message-ID: <1336027242-372-1-git-send-email-minchan@kernel.org> (raw)
zspage_order defines how many pages are needed to make a zspage.
So _order_ is rather awkward naming. It already deceive Jonathan
- http://lwn.net/Articles/477067/
" For each size, the code calculates an optimum number of pages (up to 16)"
Let's change from _order_ to _pages_ and some function names.
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
drivers/staging/zsmalloc/zsmalloc-main.c | 14 +++++++-------
drivers/staging/zsmalloc/zsmalloc_int.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 504b6c2..8642800 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -180,7 +180,7 @@ out:
* link together 3 PAGE_SIZE sized pages to form a zspage
* since then we can perfectly fit in 8 such objects.
*/
-static int get_zspage_order(int class_size)
+static int get_pages_per_zspage(int class_size)
{
int i, max_usedpc = 0;
/* zspage order which gives maximum used size per KB */
@@ -368,7 +368,7 @@ static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
* identify the last page.
*/
error = -ENOMEM;
- for (i = 0; i < class->zspage_order; i++) {
+ for (i = 0; i < class->pages_per_zspage; i++) {
struct page *page, *prev_page;
page = alloc_page(flags);
@@ -388,7 +388,7 @@ static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
page->first_page = first_page;
if (i >= 2)
list_add(&page->lru, &prev_page->lru);
- if (i == class->zspage_order - 1) /* last page */
+ if (i == class->pages_per_zspage - 1) /* last page */
SetPagePrivate2(page);
prev_page = page;
}
@@ -397,7 +397,7 @@ static struct page *alloc_zspage(struct size_class *class, gfp_t flags)
first_page->freelist = obj_location_to_handle(first_page, 0);
/* Maximum number of objects we can store in this zspage */
- first_page->objects = class->zspage_order * PAGE_SIZE / class->size;
+ first_page->objects = class->pages_per_zspage * PAGE_SIZE / class->size;
error = 0; /* Success */
@@ -512,7 +512,7 @@ struct zs_pool *zs_create_pool(const char *name, gfp_t flags)
class->size = size;
class->index = i;
spin_lock_init(&class->lock);
- class->zspage_order = get_zspage_order(size);
+ class->pages_per_zspage = get_pages_per_zspage(size);
}
@@ -603,7 +603,7 @@ void *zs_malloc(struct zs_pool *pool, size_t size)
set_zspage_mapping(first_page, class->index, ZS_EMPTY);
spin_lock(&class->lock);
- class->pages_allocated += class->zspage_order;
+ class->pages_allocated += class->pages_per_zspage;
}
obj = first_page->freelist;
@@ -658,7 +658,7 @@ void zs_free(struct zs_pool *pool, void *obj)
fullness = fix_fullness_group(pool, first_page);
if (fullness == ZS_EMPTY)
- class->pages_allocated -= class->zspage_order;
+ class->pages_allocated -= class->pages_per_zspage;
spin_unlock(&class->lock);
diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h
index 92eefc6..6fd32a9 100644
--- a/drivers/staging/zsmalloc/zsmalloc_int.h
+++ b/drivers/staging/zsmalloc/zsmalloc_int.h
@@ -124,7 +124,7 @@ struct size_class {
unsigned int index;
/* Number of PAGE_SIZE sized pages to combine to form a 'zspage' */
- int zspage_order;
+ int pages_per_zspage;
spinlock_t lock;
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2012-05-03 6:40 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 6:40 Minchan Kim [this message]
2012-05-03 6:40 ` [PATCH 2/4] zsmalloc: add/fix function comment Minchan Kim
2012-05-03 13:19 ` Nitin Gupta
2012-05-03 6:40 ` [PATCH 3/4] zsmalloc use zs_handle instead of void * Minchan Kim
2012-05-03 13:32 ` Nitin Gupta
2012-05-03 15:23 ` Seth Jennings
2012-05-04 2:24 ` Minchan Kim
2012-05-07 15:01 ` Seth Jennings
2012-05-09 20:19 ` Greg Kroah-Hartman
2012-05-10 2:03 ` Minchan Kim
2012-05-10 14:02 ` Konrad Rzeszutek Wilk
2012-05-10 14:12 ` Greg Kroah-Hartman
2012-05-10 14:47 ` Nitin Gupta
2012-05-10 15:00 ` Minchan Kim
2012-05-10 15:11 ` Seth Jennings
2012-05-10 15:19 ` Minchan Kim
2012-05-10 15:19 ` Greg Kroah-Hartman
2012-05-10 16:29 ` Nitin Gupta
2012-05-10 16:44 ` Greg Kroah-Hartman
2012-05-10 17:24 ` Nitin Gupta
2012-05-10 17:33 ` Konrad Rzeszutek Wilk
2012-05-10 23:24 ` Minchan Kim
2012-05-10 23:50 ` Dan Magenheimer
2012-05-11 0:14 ` Minchan Kim
2012-05-11 16:31 ` Dan Magenheimer
2012-05-11 19:29 ` Konrad Rzeszutek Wilk
2012-05-11 21:49 ` Seth Jennings
2012-05-14 2:26 ` Minchan Kim
2012-05-11 19:28 ` Konrad Rzeszutek Wilk
2012-05-14 2:18 ` Minchan Kim
2012-05-15 1:57 ` Nitin Gupta
2012-05-15 2:21 ` Minchan Kim
2012-05-15 15:04 ` Konrad Rzeszutek Wilk
2012-05-16 1:36 ` Minchan Kim
2012-05-16 11:06 ` Konrad Rzeszutek Wilk
2012-05-03 6:40 ` [PATCH 4/4] zsmalloc: zsmalloc: align cache line size Minchan Kim
2012-05-03 13:58 ` Nitin Gupta
2012-05-04 2:27 ` Minchan Kim
2012-05-07 7:41 ` Pekka Enberg
2012-05-07 12:40 ` Nitin Gupta
2012-05-08 1:34 ` Minchan Kim
2012-05-08 14:00 ` Dan Magenheimer
2012-05-09 0:58 ` Minchan Kim
2012-05-09 3:08 ` Dan Magenheimer
2012-05-09 4:07 ` Minchan Kim
2012-05-11 0:03 ` Dan Magenheimer
2012-05-11 0:25 ` Minchan Kim
2012-05-11 19:06 ` Konrad Rzeszutek Wilk
2012-05-14 1:55 ` Minchan Kim
2012-05-15 15:18 ` Konrad Rzeszutek Wilk
2012-05-16 1:44 ` Minchan Kim
2012-05-03 13:18 ` [PATCH 1/4] zsmalloc: rename zspage_order with zspage_pages Nitin Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336027242-372-1-git-send-email-minchan@kernel.org \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dan.magenheimer@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ngupta@vflare.org \
--cc=sjenning@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).