Skip to content

Commit

Permalink
jfs: microoptimize get_zeroed_page / virt_to_page
Browse files Browse the repository at this point in the history
get_zeroed_page does alloc_page and returns page_address of the result;
subsequent virt_to_page will recover the page, but since the caller
needs both page and its page_address() anyway, why bother going through
that wrapper at all?

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jan 4, 2016
1 parent 222e4ad commit 76e8d7c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions fs/jfs/jfs_logmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1835,17 +1835,16 @@ static int lbmLogInit(struct jfs_log * log)
for (i = 0; i < LOGPAGES;) {
char *buffer;
uint offset;
struct page *page;
struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO);

buffer = (char *) get_zeroed_page(GFP_KERNEL);
if (buffer == NULL)
if (!page)
goto error;
page = virt_to_page(buffer);
buffer = page_address(page);
for (offset = 0; offset < PAGE_SIZE; offset += LOGPSIZE) {
lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL);
if (lbuf == NULL) {
if (offset == 0)
free_page((unsigned long) buffer);
__free_page(page);
goto error;
}
if (offset) /* we already have one reference */
Expand Down

0 comments on commit 76e8d7c

Please sign in to comment.