Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2963110imm; Mon, 28 May 2018 21:04:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJNcgKhOx3F6ryA7Jc+x+gNCkxNAzg4cudM/531WFp79e35aAunbqcwwayCBvaCO5T1fKo+ X-Received: by 2002:a65:4c4d:: with SMTP id l13-v6mr3794536pgr.211.1527566672258; Mon, 28 May 2018 21:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527566672; cv=none; d=google.com; s=arc-20160816; b=vnUDH5GSZYTSfE++aeEq2Zk6Gmcad6T8QXPi8eTnwpV/VjW836i2srI8Mu+Wq2xkNp cSu0K+3+EbyltR4JJkXGMI6RRNuSQ8FLsPvsSG12LNl3EyfkFaHkgRZs3GMI3NqGTK5P 9LTS8P8U7rgnsRQnxERSGAJfLjoF6ktbn2pyxSBmD67P6yvXtQ0Xrgj+9IaWOwxX4eHt CclYQuk9oRAW0vXVIFKWneWlixQwP2xXiSkSOUf60VUV0tDRzkTAu7yvZe6zlmupBBs0 GPO3wulZ5TfNcRrN5b/CT0mGCIa9DP90Wia2MEPZfF0sXN63nK8NEAIfN0WL4SKbcppk Xl1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:message-id:date :mime-version:dkim-signature:arc-authentication-results; bh=R7jVZ90AMTjQr8rJqBXOzpEDWrzP3PGiF/9zpHZbNmc=; b=XxMn9wzR/DCc2M9Nzlqm8OFbeX1s2dwpBk3r6Dm35HrD9cGpVKvyygD2iyG4fDyPH1 1Lhee/ZWddsyMWbKOHaAxIJNc8VuftbclzrrUE2ksNrz+VYToGjkHv3cr15r1ao7U14i kWawxKL+H2BLTq111NCML0cWPqK0rCj12M/skkUn6wzQRBXS/fle0uZi0jGPr/u+iXLi AQ54HO9nMCLxQWIHOF56FSrMc93wEvjl7ZQ56eAbY4wo+Ln+/axm1SylLmJApDdi4cME MsB4U6YKlCyK0XugcvEXwv6D0igxTREbfa4GG4BI/3ztH2l1CGb94b543xa/bjDaHAn/ Llbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RM8f5slG; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n128-v6si11137560pga.70.2018.05.28.21.04.17; Mon, 28 May 2018 21:04:32 -0700 (PDT) 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=@google.com header.s=20161025 header.b=RM8f5slG; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936859AbeE2CoC (ORCPT + 99 others); Mon, 28 May 2018 22:44:02 -0400 Received: from mail-qk0-f201.google.com ([209.85.220.201]:37538 "EHLO mail-qk0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932498AbeE2Cn6 (ORCPT ); Mon, 28 May 2018 22:43:58 -0400 Received: by mail-qk0-f201.google.com with SMTP id w74-v6so9831912qka.4 for ; Mon, 28 May 2018 19:43:58 -0700 (PDT) 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-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=R7jVZ90AMTjQr8rJqBXOzpEDWrzP3PGiF/9zpHZbNmc=; b=Aa0daiFJeBbpUDL0K52KAxzlZXzEp8/Hs5Mbovr5xcIw5mO7GYZ0ykGj0Rrr1Be80y nbinbpC5tsEuX0xM1cO+UbcFT1KiAEd1kgY04VewtGxzQzOgMyV08QJBdR6HR4j2Yg3R 4APl0L7g0jteCp7NAz9lvSg81SSGuf0SqU4cVVsCyjOCdqW8MdyAJ19/Y45JAI0odUAy hMVN7AwgRGRyeyc0UiSMrdjcb667ZuB+E7M9l+PiDf31s7T19Nh97P3QSYfk7x27m/dg Xe8A1Apeqy+X6AGDX8cnwsSGzhQRSLqzEKI/DfuTO+YN5OtZnDdD/xpQSwUiSPm7WsVQ ee9w== X-Gm-Message-State: ALKqPwciunLaQS6mZqrKtLpzmaV/VyCnhz157kl6LO7COBaikHqlwBf9 3JpkXgYG5cADmtjv9w9Gf32sWHG3TP6e 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.17.0.921.gf22659ad46-goog