From: Joey Pabalinas <joeypabalinas@gmail.com>
To: linux-mm@kvack.org
Cc: Minchan Kim <minchan@kernel.org>, Nitin Gupta <ngupta@vflare.org>,
linux-kernel@vger.kernel.org,
Joey Pabalinas <joeypabalinas@gmail.com>
Subject: [PATCH] mm/zsmalloc: strength reduce zspage_size calculation
Date: Mon, 26 Feb 2018 02:21:26 -1000 [thread overview]
Message-ID: <20180226122126.coxtwkv5bqifariz@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 961 bytes --]
Replace the repeated multiplication in the main loop
body calculation of zspage_size with an equivalent
(and cheaper) addition operation.
Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index c3013505c30527dc42..647a1a2728634b5194 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -821,15 +821,15 @@ static enum fullness_group fix_fullness_group(struct size_class *class,
*/
static int get_pages_per_zspage(int class_size)
{
+ int zspage_size = 0;
int i, max_usedpc = 0;
/* zspage order which gives maximum used size per KB */
int max_usedpc_order = 1;
for (i = 1; i <= ZS_MAX_PAGES_PER_ZSPAGE; i++) {
- int zspage_size;
int waste, usedpc;
- zspage_size = i * PAGE_SIZE;
+ zspage_size += PAGE_SIZE;
waste = zspage_size % class_size;
usedpc = (zspage_size - waste) * 100 / zspage_size;
--
2.16.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2018-02-26 12:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 12:21 Joey Pabalinas [this message]
2018-02-28 0:03 ` Minchan Kim
2018-02-28 1:26 ` Joey Pabalinas
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=20180226122126.coxtwkv5bqifariz@gmail.com \
--to=joeypabalinas@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
/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