From patchwork Tue May 29 02:40:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Thelen X-Patchwork-Id: 10434283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C767C602CB for ; Tue, 29 May 2018 02:44:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA40D28405 for ; Tue, 29 May 2018 02:44:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CA9028433; Tue, 29 May 2018 02:44:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C58F28405 for ; Tue, 29 May 2018 02:44:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 319606B0003; Mon, 28 May 2018 22:43:59 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2C9546B0006; Mon, 28 May 2018 22:43:59 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E0AB6B0007; Mon, 28 May 2018 22:43:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f198.google.com (mail-qk0-f198.google.com [209.85.220.198]) by kanga.kvack.org (Postfix) with ESMTP id E7BA06B0003 for ; Mon, 28 May 2018 22:43:58 -0400 (EDT) Received: by mail-qk0-f198.google.com with SMTP id y124-v6so12090408qkc.8 for ; Mon, 28 May 2018 19:43:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:mime-version:date:message-id :subject:from:to:cc; bh=R7jVZ90AMTjQr8rJqBXOzpEDWrzP3PGiF/9zpHZbNmc=; b=hmHn0yCbwrmLFSffQMISPzs+VGchSixrqy0cavNPawshPNPtz7lYbEgYTzL3b2eQ0E FTUrI2fWvrhFTF+lRfmgE9OT2tMJarmy2u6FhC+QCdKlI64rbjYA7f6EBiwIr2Yief3B PuqJUcNbZkOcqmY1mxcl3VWf7ejojhI2b247NfGfBD6vyRxSZwKXSRAGFJtvUekDzEPh IBsOlL0mXsevYuKUE+my+kM61VOpZzgQTSoPpM1tyUEjqRsQYp652VHSO6kFv0+SX5FP gXBOHxnZj0h4QSaNIwxPF816xhvn5Mcw3IdwC8FC59sXQCmi4vU6r9FAgpBSpMwKdRGo fgEg== X-Gm-Message-State: ALKqPwdxgY9aUdCtd8AKohSAsum/ucF4mtpsfiJpVZJ/F/YCJn6ybz7n 8MaIc1zHwuleUPnCqxFvYroO1NYTp5YPs7FsE5OKm2H2NTx7rqCR1YqQiL70Nww0sq1PzwxvSZX Qq9dvXP0eADces+36e5eUGBKJTOIMGaqzLwvjSxAni/a1MUjrhNXx3HVlcw3SetLIwwZ4s2hnd3 /2+gNKUM+OkR+TDtrFBbwxMTUWjx4sOhR9XARDyQFRs3ipLzrkmrqVJGS5uyS5RSNg9ByUIGlqQ jN7sgflzcWF9C3grroDeQ+ToA3xNsgssc6L2Hcm9tADYpVgnjftP5uvme+0jclOOkqFnfRKaXBe i/xnsf3kqbmtOJRrGW7E2ST3nN4T/vIMoaB6mqBDnvSpd6EESyM0RoDtjfzAlBUXUg+34OnsNOQ K X-Received: by 2002:ac8:1bf0:: with SMTP id m45-v6mr13069567qtk.337.1527561838680; Mon, 28 May 2018 19:43:58 -0700 (PDT) X-Received: by 2002:ac8:1bf0:: with SMTP id m45-v6mr13069551qtk.337.1527561838137; Mon, 28 May 2018 19:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527561838; cv=none; d=google.com; s=arc-20160816; b=u2zlT/F4i3oQyJdGoLkSfFNSSnVpUdYbqcWRlsKy+j3IC8A2s2Eb25CesgNY5hRezo hxGYdEktM8nltornu6lsmBRQ86KjQDO7RjJ4tgKvPUBuPb46hoz7r2reiCLIUeKtmscO OpysxXTdmEH+2WM1HP+5Y+kTfaei2brsqwZrRP42j3kanSRE3cOILY6rDQq6KpsmVyzc oOcXvf0TQgppAU2cx/lLqiTH2AQ75zcMVbM3zUvPgNRXeZw8fx1/KUtAz1BeVwlbC8KE nVt+97Xl3h+bUVFGFZHLWxmXRUNtBkUMioD6pFd7vfqxXNxwICJCvtKGgohSfp+/E40X TbdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:date:mime-version:dkim-signature :arc-authentication-results; bh=R7jVZ90AMTjQr8rJqBXOzpEDWrzP3PGiF/9zpHZbNmc=; b=urn5Invx6b8GLyXzE2/jRPYvVqCQN1SEtP+a73RYkUE4tzGO/CR3i1FmmUqen0cpm3 WlqL24Gx7dKCaUpvOd7SBYxXoLtRB28VmKUNcgsthMCymU8E+O6tGEbREMfd13xs3RuC KdjBm/vABzdsFVKlNvbU8AiNyiHw+eNy5mfyjQhwwtID7rMpnsoN3wmWI24rPpFs3aRT 5zJBvB09ruYWp7KEWVDgKxXeAfGmhDBgcQYQOUhFS+cjdvC3jqdYXSm/QM+vql13+jg0 VzbZ0zntFUYKDwrUxyCGO02E3bF781CSlLLX0BSaDmyfuIelrL8fXAGgrhX1cD9d/SRE LK/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RM8f5slG; spf=pass (google.com: domain of 3bb4mwwckcpoivjgngpiqqing.eqonkpwz-oomxcem.qti@flex--gthelen.bounces.google.com designates 209.85.220.73 as permitted sender) smtp.mailfrom=3bb4MWwcKCPoivjgngpiqqing.eqonkpwz-oomxcem.qti@flex--gthelen.bounces.google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f73.google.com (mail-sor-f73.google.com. [209.85.220.73]) by mx.google.com with SMTPS id y26-v6sor4566677qtk.142.2018.05.28.19.43.58 for (Google Transport Security); Mon, 28 May 2018 19:43:58 -0700 (PDT) Received-SPF: pass (google.com: domain of 3bb4mwwckcpoivjgngpiqqing.eqonkpwz-oomxcem.qti@flex--gthelen.bounces.google.com designates 209.85.220.73 as permitted sender) client-ip=209.85.220.73; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RM8f5slG; spf=pass (google.com: domain of 3bb4mwwckcpoivjgngpiqqing.eqonkpwz-oomxcem.qti@flex--gthelen.bounces.google.com designates 209.85.220.73 as permitted sender) smtp.mailfrom=3bb4MWwcKCPoivjgngpiqqing.eqonkpwz-oomxcem.qti@flex--gthelen.bounces.google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:message-id:subject:from:to:cc; bh=R7jVZ90AMTjQr8rJqBXOzpEDWrzP3PGiF/9zpHZbNmc=; b=RM8f5slG8CCPSY3clxBWCAmFTNstimrqZLS1uKryb74i+N2T3ROJ+4J/aRt3gT578c ExSmAYUEyw4VR8Npq3hrhAf4KAav+hvh5qgYO0z9K+PUOaMlKxmEd1Y9VlAEjeOYbS0n Sx3bba7XrZSM6+XEd/PQjnZkwpkaM2ZYtTxxxiWN1wTpFPdhQLDm3j7+/ycjld403kAS fSRbhACaGoLWeXiZvY9Jli+rFQw5wPXd/CPpPm0XDt5J6FMMTu0YXpzQROX7Nxlzh/I1 twsNJ+Jx3Kp2wsh9OXvCkPbLSunQVT64d6gYUd5DivUvRnb2ZVbnrYInngmoXYB/mp53 TCmw== X-Google-Smtp-Source: ADUXVKKhasWRMO53OomcShIZum8mluW7W3M4S7nFal5Kt7MoAZlTOmnETanznHV8SJ1Yoqp8u+892uTdz7ca MIME-Version: 1.0 X-Received: by 2002:ac8:6715:: with SMTP id e21-v6mr8729036qtp.25.1527561837712; Mon, 28 May 2018 19:43:57 -0700 (PDT) Date: Mon, 28 May 2018 19:40:25 -0700 Message-Id: <20180529024025.58353-1-gthelen@google.com> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog Subject: [PATCH] mm: convert scan_control.priority int => byte From: Greg Thelen To: Andrew Morton , Michal Hocko , Johannes Weiner Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Greg Thelen X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Reclaim priorities range from 0..12(DEF_PRIORITY). scan_control.priority is a 4 byte int, which is overkill. Since commit 6538b8ea886e ("x86_64: expand kernel stack to 16K") x86_64 stack overflows are not an issue. But it's inefficient to use 4 bytes for priority. Use s8 (signed byte) rather than u8 to allow for loops like: do { ... } while (--sc.priority >= 0); This reduces sizeof(struct scan_control) from 96 => 88 bytes (x86_64), which saves some stack. scan_control.priority field order is changed to occupy otherwise unused padding. Signed-off-by: Greg Thelen --- mm/vmscan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 9b697323a88c..541c334bd176 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -83,9 +83,6 @@ struct scan_control { */ struct mem_cgroup *target_mem_cgroup; - /* Scan (total_size >> priority) pages at once */ - int priority; - /* The highest zone to isolate pages for reclaim from */ enum zone_type reclaim_idx; @@ -111,6 +108,9 @@ struct scan_control { /* One of the zones is ready for compaction */ unsigned int compaction_ready:1; + /* Scan (total_size >> priority) pages at once */ + s8 priority; + /* Incremented by the number of inactive pages that were scanned */ unsigned long nr_scanned;