Received: by 10.223.185.116 with SMTP id b49csp3708804wrg; Mon, 26 Feb 2018 04:51:14 -0800 (PST) X-Google-Smtp-Source: AH8x226lQXIL/clXkouv8pQ6XNQgDLvY48pURMmMdjMLTGQnPDCU0xTjWO/xawp67R+0d8C1W4oB X-Received: by 10.101.91.3 with SMTP id y3mr8454797pgq.149.1519649473963; Mon, 26 Feb 2018 04:51:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519649473; cv=none; d=google.com; s=arc-20160816; b=qoAJ+s1c4qVnhB187cv27SLUCgPHZl9/NirFvjHwSzLgnoSkMhhgAHdcgf/p2HnwJH 1Kg+n1xss/tesScgn60ujpQ/2c0jQDuL6tV1p1po+Ojs5TAJoWt3JNtVouPmYsLHHmTX L9T5AEPBjotkzNiyr95IDPzU7Bvkt7hZ3btsmPoDJMUnnaT8c/yb1Bl/HcM5GqHP+Vsh urPFj8Dlgcy8eMhc35pLLenT3UFjIu3VWTMDSpV4tfHZUWdN2wreNn1RH2j4hhS5kNAq rt7s9u6CeOvsa0tKlsLtLy0i/Ko3ybTQofalNriR0FNxhAsfUqirbG/CyjC3P1gpZOqP DsXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=thnGFNDh/CTpzpbYIquNx1eRbRoKNivvJSuxCB2bzVY=; b=mnrP3LUAMNI2J52tsurqW9KOTqGBLZC41GtAxKukdWylIBb4kg08AyVT3kMaFwhMfV ddhUGud2ypmNmiChBkERLON0P6ATqOVqjnVZq83Fg5C1PgB8Qf6P6GnH5MFSPwwYgS7W XZ3UX8PU0Fgg6JBY1OofERM7uSQ4WQVi41CxipDU/VntZgq/mW0K+35cIW1q7mUiR529 BCfRJi9ZuhGWtmeFuJc44M8qmDPfbB8qbvvZD2XL1D9S9805GBkD0+1ey7B518E4wZDA qn+5b0Rw0FOvcD7i5dPMinvbbpbVw3eG3FTcxpeEXunyIkjj6ymCrHTXSUMA9KxXdiBd q7Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=O3Ln7Lqa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o3-v6si5292897pld.591.2018.02.26.04.50.59; Mon, 26 Feb 2018 04:51:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=O3Ln7Lqa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752565AbeBZMVf (ORCPT + 99 others); Mon, 26 Feb 2018 07:21:35 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34722 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752402AbeBZMVa (ORCPT ); Mon, 26 Feb 2018 07:21:30 -0500 Received: by mail-pg0-f65.google.com with SMTP id m19so6106267pgn.1 for ; Mon, 26 Feb 2018 04:21:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=thnGFNDh/CTpzpbYIquNx1eRbRoKNivvJSuxCB2bzVY=; b=O3Ln7LqawUlm6qI5JH3gOm6QMSqqPt50K2iUnKZJsfnMj8LHAyW06oi0xRiwk0wLfU PVok4WVk+KXRT48tfQKwvptpFauJuUXR9oIcTrruCDYdlIdLYPdZJ+j2HY7yOnj3uknI y2BJR9W//mckG7vNMpejQubW9pyfCwiLtyg5TWrwqx68jMjZCOrIpR6vMx6Lib6DTYO5 vL61u8gHkCk29LGOQpNAR45eSkQQV6Cpv50c3764+do6jr4P1oj5LIJCMxjlx+iU5GxB +s4dBgLKKOng8OhHKegkbdtfSR4UDuT9cPtbpvWPaPJTgIy3BfIANnD7pvz8HqOzo3Sl /fFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=thnGFNDh/CTpzpbYIquNx1eRbRoKNivvJSuxCB2bzVY=; b=XSf5wbpMYA5h8cKgiNQXWmNeiYRQjoFN3WmGRKIs080MO7eox7DyG9fVAtIZp98gI8 d0zEdCemQx0eSiOl+SbfLbWCTkrFoKvz8Sw8Gx7yvezX48brHbMJHnIJvm3KqnOOIrtw VI9tA7fLc8ehEKGGWltviLS6NdL4PzsYSl6wVQteskpSKhJPecCFQIkLt5R1ZZ+42if4 5luF8FNTsHO7x4qdAyU0BI4ka+bDviWBI8pxz5g1BY3C8Qo0ofSbiDRvGPD3hocY3DLQ efb997kZbE4rVd3NBzDzmXblKt6BaHUWE6cTFLB8kB15jPlTrvmd8Dk9HdOfqQ6WaT++ x8Dg== X-Gm-Message-State: APf1xPBmqFrtGIi8RrHjVZYbaklS0rac7Ub6ftKrdfa2CHcuZvSirypf QJoe1bD1RamRrlBLdNAQBZ5uKg== X-Received: by 10.101.74.208 with SMTP id c16mr8341479pgu.116.1519647690451; Mon, 26 Feb 2018 04:21:30 -0800 (PST) Received: from gmail.com ([2605:e000:1117:c19a:2e0:1bff:fe70:ea]) by smtp.gmail.com with ESMTPSA id q2sm13055774pgf.10.2018.02.26.04.21.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Feb 2018 04:21:28 -0800 (PST) Date: Mon, 26 Feb 2018 02:21:26 -1000 From: Joey Pabalinas To: linux-mm@kvack.org Cc: Minchan Kim , Nitin Gupta , linux-kernel@vger.kernel.org, Joey Pabalinas Subject: [PATCH] mm/zsmalloc: strength reduce zspage_size calculation Message-ID: <20180226122126.coxtwkv5bqifariz@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7mhpi7vsyt344z2b" Content-Disposition: inline User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --7mhpi7vsyt344z2b Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 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 =3D 0; int i, max_usedpc =3D 0; /* zspage order which gives maximum used size per KB */ int max_usedpc_order =3D 1; =20 for (i =3D 1; i <=3D ZS_MAX_PAGES_PER_ZSPAGE; i++) { - int zspage_size; int waste, usedpc; =20 - zspage_size =3D i * PAGE_SIZE; + zspage_size +=3D PAGE_SIZE; waste =3D zspage_size % class_size; usedpc =3D (zspage_size - waste) * 100 / zspage_size; =20 --=20 2.16.2 --7mhpi7vsyt344z2b Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEKlZXrihdNOcUPZTNruvLfWhyVBkFAlqT+8YACgkQruvLfWhy VBknzhAAtnEwRKPM+ZxbJSgwy7J86qbCe+5kAPdN7Ipd4QO0aGQquBKkOaJD/v/3 SsSd2oQaPtIAqukwO9b18SPrICUbysWxcK3WQVse0jx6qqw4amnUrlQDnKNf8ZII qwaqz2grd0GBO91N6WHFSB4lGNtCOObt8ZDT8rDtQ4wZlXg0Qr5Mc4zH7MbECWcE 9UjTKqd/jbIxDawY8zzq0qyd/xVg3s4kJqkdpF9dXeUJetXjgvXtj99f507lFrgQ BK8fL2MT3uQsNax6Ay6D7pzDWMULj/bivvr8KxliJGAGTAVx2g4rkCcMaQBZtB+s WvH15FeUBtct2KMfpq8a9u6jOqpMaNVXSAtLW1aM3i0AIcONTYuSLXvsWjOta7SB +6M2is0HyOXfk6CBQbZPzVFdMGoPRO8VncT+sGrWnRVzjhRqDUvbfkYDiSSFLTbi 1L4PjRJQOo2s+N297S7TRVVpuX3407FyUNalYD4/1PVs80H1q4oHMBvTJpWtJBnN sjsLnimhqMk7wwGRjgajnLxXCeBB9g+bd8j5tyHv8hZ+dXtqQMnAiQ5Q6reKGT9/ CUGcDdH2ROA9w8ABYo8+8ebubUnj9OOWv2yaNz5KxrANuAv1OAQiob7S+aXwOya3 UBP809gCQyAYp6mIM6s9t3kjq0arJoAKrwllOlg2IuJ9LVufW64= =3G7G -----END PGP SIGNATURE----- --7mhpi7vsyt344z2b--