From patchwork Tue Aug 21 21:35:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 10572375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D61E0112E for ; Tue, 21 Aug 2018 21:36:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D803A2AE2C for ; Tue, 21 Aug 2018 21:36:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE52F2AE3C; Tue, 21 Aug 2018 21:36:55 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE 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 6DCF52AE69 for ; Tue, 21 Aug 2018 21:36:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 50EEF6B20BB; Tue, 21 Aug 2018 17:36:53 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 495696B20BC; Tue, 21 Aug 2018 17:36:53 -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 311296B20BD; Tue, 21 Aug 2018 17:36:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by kanga.kvack.org (Postfix) with ESMTP id AE0E46B20BB for ; Tue, 21 Aug 2018 17:36:52 -0400 (EDT) Received: by mail-lf1-f71.google.com with SMTP id q35-v6so1412031lfi.1 for ; Tue, 21 Aug 2018 14:36:52 -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:dkim-signature:from:to:cc:subject :date:message-id:in-reply-to:references:mime-version :spamdiagnosticoutput:spamdiagnosticmetadata; bh=AtNuxCAd7TECN28SamN4dQlQrOCShOwPTHfKehhUkiY=; b=bseLalj50KifSTkdY9ukqnXWEHW2/YDPKeVesuuBrG3HN9gGjDkVJf0P5qzOkmQ1j1 3HQ2LIbrGZD5q78kVJNusIK1mjEDeCmV7NJCq7vxyYj2o1FpIanQMbd8bH6bWwBlAPp6 hF7qsSXJvM0ruRUlXBB2N+KmDZzs/x6ZFKs4ULX2SSHjYq0iDm44d189x5l091p3K/U8 Z4EyUaHtGLj+tYf/YDTZwhao5C7L4rBh38HuA+gCL6+/pj54tP+z2ELzt5CdRxcdodd4 CszFUns0n2PhGSHVFvy4/O2ex6MOJsARq4NPXoJD7Wdy9yEdEVeK1GwSeSWnHjpOnx28 o0vw== X-Gm-Message-State: AOUpUlHH4OL3u31TPW8ua2pz8janj1Ea3nvN8XmKcyjt8P9kxg5BBFQ4 FlIpodW4STVwVPBctMLoylg4m8YVB6NNXUvMDZtiS9EB8sO/AXRyUpVjKPfOGkXv7X1tXTsDqKy EvTw3mpTcTCtvT4qhd9ap04RCJV6VnA1P4iRi2LyP39nPxmBpVp1j6NJfwP2vHMRkYQ== X-Received: by 2002:a2e:4619:: with SMTP id t25-v6mr36959655lja.96.1534887412033; Tue, 21 Aug 2018 14:36:52 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzyp11KRg2KUq5dt9GUWPkCkhtLAmmUft7bGKcUeXOeONpyRk8ezgBRodJVPwcjHQpK/Y7v X-Received: by 2002:a2e:4619:: with SMTP id t25-v6mr36959631lja.96.1534887411121; Tue, 21 Aug 2018 14:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534887411; cv=none; d=google.com; s=arc-20160816; b=P0+MJOAequ4Y3XjKjrNnAdd7pSx1fG7TlZ/lR3XCRIBk6I/FoJbHyPN3iJE5Lq+gR1 4CczJtSmvBZ/nRIcNSepQsereEBJrVe3CzQboRc5XPQo2mcE6/N22u65ASUdgltoS5qn z0ZlF+8jnKwcJZNjY83DkkXsVzvIPk2Hp+W5NY0KXrYB24y10xNaIK4QhRVO0DTHbDDh 2HgJ+Yi/0+N2ob371Ss7Jae5hVOK+RQeW0IUFc3dFtBep+giR6lEVMU5l6tpQVm6+hfP DoLXQg5pfudpxwT0/twwXg/tb5E5HZzUgw5G5ZVuiXVROaUMhNJ4cqXSSu3m6tYDIzLT MLTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-signature:arc-authentication-results; bh=AtNuxCAd7TECN28SamN4dQlQrOCShOwPTHfKehhUkiY=; b=nRpNkeKj6jZ743PYzNRxPOGy8uQ5F9JZlIIkn3eYYqa89Mp+jFyunjHZuC3xOEiq7w v7s1d1+/25sUBczsCnMaFNTWaK8AOnPdalXGy0ddV/mXyWOem5/OwCty2NkyC8pry6tF bDzAunrTD3eCoMkTD06fBMGCV70vxHNJ8TYYfa7Nu9qib0QaPlZgO3VDIQLbmIMEemxm uOKKOY2DI2mcPcBYsg8ipESisnInH7A0E9ghafaG8/IKIuvpZmNCTFr7SHHGu3BlDZS3 SM7ull2wb2q3PgICyGgmqM1sT3C/n5acqVMenrS+LX/64gYeMSuRqL8flQkv4b5wMEDO jQOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=DGg+vclb; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=Lgq7d7uW; spf=pass (google.com: domain of prvs=177171ea8f=guro@fb.com designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=177171ea8f=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com. [67.231.153.30]) by mx.google.com with ESMTPS id k16-v6si6243740ljh.387.2018.08.21.14.36.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 14:36:51 -0700 (PDT) Received-SPF: pass (google.com: domain of prvs=177171ea8f=guro@fb.com designates 67.231.153.30 as permitted sender) client-ip=67.231.153.30; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=DGg+vclb; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=Lgq7d7uW; spf=pass (google.com: domain of prvs=177171ea8f=guro@fb.com designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=177171ea8f=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7LLYGVf010571; Tue, 21 Aug 2018 14:36:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=AtNuxCAd7TECN28SamN4dQlQrOCShOwPTHfKehhUkiY=; b=DGg+vclb8Efw0NXz5xBuHbfrNiteeGUPQL7H8PG02tFFC5w/1by8xyc5mw2N7GhzJvVH LCe3Q4Q6cHDf/4ll3BlSd37urE/oJBQzSZHgg8UeCSCFmTnCurCcvLcGfHCLsB2g/gPw WUU0xDVFfxZJTLRFJBJZck5ZvSg+qnnH7J8= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2m0ssj05sg-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 21 Aug 2018 14:36:24 -0700 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.29) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 21 Aug 2018 17:36:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AtNuxCAd7TECN28SamN4dQlQrOCShOwPTHfKehhUkiY=; b=Lgq7d7uWgarELyI34TnUPnI2stRSMm4W9mKIh4PRGBJjiLf5hLuMGIgPc6Yer3kPKdDSLXc5ZI6f5KqFh3BKdWEcRbTaCHvPi21Hkj8Euu3i3qLNe1tWtVGBLa9xSadZMAYh+wCEGjIFCE97roxL3bJR9gF08WXNtdNKpTwHBq0= Received: from tower.thefacebook.com (2620:10d:c090:200::7:b0bf) by BY2PR15MB0166.namprd15.prod.outlook.com (2a01:111:e400:58e0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Tue, 21 Aug 2018 21:36:17 +0000 From: Roman Gushchin To: CC: , , Roman Gushchin , Andrew Morton , Johannes Weiner , Michal Hocko , Tejun Heo , Rik van Riel , Konstantin Khlebnikov , Matthew Wilcox Subject: [PATCH v2 3/3] mm: don't miss the last page because of round-off error Date: Tue, 21 Aug 2018 14:35:59 -0700 Message-ID: <20180821213559.14694-3-guro@fb.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180821213559.14694-1-guro@fb.com> References: <20180821213559.14694-1-guro@fb.com> MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::7:b0bf] X-ClientProxiedBy: MWHPR1301CA0004.namprd13.prod.outlook.com (2603:10b6:301:29::17) To BY2PR15MB0166.namprd15.prod.outlook.com (2a01:111:e400:58e0::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d642fca3-da94-4a09-ca7f-08d607ae2110 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BY2PR15MB0166; X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0166;3:LIBr+b21RooN9jRroTXs615jOiIuFKiW+AnvWZcTWQk1CZM8WocHJde+ADyH39Mm7+bFfWZmo7gcY3VfEy6yacHVHLh0U3zmQNDOYvpHAmNC20TYufAFxo9rRAFxKSYsx5PShqRaIVOwOZ9Rkc1vzLuyyizFzH9IMJ/g9IH3B2okbITxvzeYeak22o4myQAObGjlRWss6CUubQNkXA+oNgRzFsFpGyHuUL/bDtCJctwOfpHWQaG2J9Svf8MRyWQy;25:XWtKi1pOzsSvDscwOwVf21Ar/6gs1YH6QC9s6Dc2PWr2n1tqS0czPmaGtmcGqlELgcFY7i95lEdrrghgY6L3JysrtVcKDUJu2Mpe/DJjGGMmLXeUSBVALAuAje08A0suCXaKmUPW+DNZWp6vDlulVn/sSOqfeA5Uww8kX1Tyav1zwTXouCc0yqq1nJt5C5AVkT5y5xmIlZmkBtdbZwx+Q7TgKAu9L46FIGTmJjm44mFCfw0sz8lYGYxr1KSkksP+wXvtklUucscgxvYoX64yT3CZST52dloDdmYeSx1JuVRyInSu/OGc+qigAXdJD9b8/foKmJYmQWtWT+NEIusBag==;31:ZVL8h2o8SHYz40lFhG6k7z29gRsezh9UhvaVA940Bhi7aE/VIFdicJf8JSHXB490f9uFdKccTrC6rPxs+g4fxryZrcvnNWytrO9h5NTw0KAxg+Q8rMOpTkhUBL4BBr6yW17grtx9H0s+2OoIRYaURHalYA1a4SW5NGETqkPHl37/fMp2xK0tSb42i663p+5BVT8EqsSEy8ak+E+SacGZZr+YAe6gUdbYDRje8l1L9p8= X-MS-TrafficTypeDiagnostic: BY2PR15MB0166: X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0166;20:GOgscW/zu+6S9gsbsw+9Hy61JZ50qxlxt6bYSIWgSf94dxTUWx4tj1IX3I+xPRonC4P5441QR5ed8rea/Orq5ormLWU19+iZQlR0bRi9CQt48EfnuuSLJVsS8EKtAQgWJ+It+aTEEE7jyYcD+0qP88EE8LfSQU4kzN+nrZ5WNr2XQ+dl2dUtUNMSAyCDp3sfuLx0+q/K0zbKYh+AXVF2sIJd4QYyE/Py52Zn4eOPuU84nHvMkn3H6rjt9pKPwthhK3sPR2rGd4lJDgtw6RnqlBP9ZqtgVaeW4jzToXQv3w9Q34U/PicCykyqyOIp5x3YkS6XHRAVh6ddutvx571ZikgDBESRcMkcdK530U3yRmnpRaDujyLNICg/LG8hFLhbtuVnetNL+mql2/tILn4DBC/mfmcSwqZNB/Gb6IPUptTEfJTvtPawJcpgfOwtOWuXZqZpeGbdL2Cms2FEhEiduY2cDTZMP9n8t+pG11BY3w8bO0lbDg0Abne10nSkCKwH;4:EOjS/smeJd1k98sbq9ecI8oer0bxN4DadOT2HlQtXGoF14dKeDa+x8scsGC/BAhhug8uQWycw3nm96imIg6pgBwYO/iebaF6u48u2L6LJpGd3+Gjazl4dGIxt2R2YozfeYzQ5/zR7G/dexQQ/XhJ4aklRoCBdHDq6VHLHz2Gda3hJ/YScm34cKr89LjZs4iZuA07mZMdIAU+zfIxGHg9Gul8d3mjjlodhI7pmfbJFL3eMvpD/9/daNox8K+YzeZFsMS/eYALywaaF8zjNAoF0SllGk9TuZ5VNHnXttkqh8nUIOxM8c0UenuwOJgkKRgPlyadQCpez5Mh33px6K7OHuEbjOTi+E+CEvYTHjMHDSo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(67672495146484); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(823301075)(93006095)(93001095)(3002001)(10201501046)(3231311)(11241501184)(944501410)(52105095)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);SRVR:BY2PR15MB0166;BCL:0;PCL:0;RULEID:;SRVR:BY2PR15MB0166; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(136003)(376002)(39860400002)(396003)(366004)(199004)(189003)(53936002)(68736007)(39060400002)(50226002)(8936002)(25786009)(1076002)(2906002)(6116002)(4326008)(476003)(486006)(86362001)(16526019)(97736004)(6506007)(186003)(386003)(46003)(2361001)(478600001)(105586002)(48376002)(50466002)(54906003)(446003)(106356001)(6486002)(2351001)(2616005)(11346002)(6916009)(76176011)(52396003)(305945005)(6512007)(8676002)(53416004)(69596002)(36756003)(16586007)(81156014)(47776003)(81166006)(316002)(52116002)(5660300001)(6666003)(7736002)(51416003)(32033001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR15MB0166;H:tower.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0166;23:y0hBRbMJzP+aNudL97O3T5kyvLzHJjmpSEXCS3DcZALUZJgzhSCgQg9j1mA7BlGBEngDRouKde43EdX8k4oRLvCk3yY02i+4HrXwj471NszSe/1X4hT2hkSMM+WdaHBG1zqYUi4uMsZLyNeeu2is7w/ZWMfQN8bCvaLHJZSayEdxt5YwiEDNLUp4V5Ieg3xZqMKXJVQcpX8tz0zZYx9Yqct2QF5u/GdtbSgQpKffccad+uZfC6omSv7rkreWBcfKdTE4tjgKBffR5x00PJXS5WvhbisSw89aVLdjdjqzovMXdE0Pu6QJ8jALtBHBDqlc0WEob87G7shprWHiJUFtMA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j8O+6oGPxz/pzMoD1kUd8IbLyXZmJI6ieDZFs/qF3BXyXMmthkSJHZ3UfzI3uh3jUYtqI4GEER+bgi+VfZU5VwqfenZKCmfxRZnCv5Sev9uv6qb/DA596IRR9LJHUunRhuvuemVTwx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0166;20:EWokAItNE4ut026bbDHsbyZ5DRk6mePeiyLx/68KdmyPckPmFrCGm6Gzk+un71kunFzR48SxJSU5hEkjyOPhVf164cPbhKuNJtMRIQfqRf6jAoidczWnNproN0ITuqlyn19+WvS44sd+bnLyFmOkYo2cH/Ryzs1/5vgLMUD31BQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 21:36:17.3081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d642fca3-da94-4a09-ca7f-08d607ae2110 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR15MB0166 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-21_09:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe 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 I've noticed, that dying memory cgroups are often pinned in memory by a single pagecache page. Even under moderate memory pressure they sometimes stayed in such state for a long time. That looked strange. My investigation showed that the problem is caused by applying the LRU pressure balancing math: scan = div64_u64(scan * fraction[lru], denominator), where denominator = fraction[anon] + fraction[file] + 1. Because fraction[lru] is always less than denominator, if the initial scan size is 1, the result is always 0. This means the last page is not scanned and has no chances to be reclaimed. Fix this by rounding up the result of the division. In practice this change significantly improves the speed of dying cgroups reclaim. Signed-off-by: Roman Gushchin Cc: Andrew Morton Cc: Johannes Weiner Cc: Michal Hocko Cc: Tejun Heo Cc: Rik van Riel Cc: Konstantin Khlebnikov Cc: Matthew Wilcox --- include/linux/math64.h | 2 ++ mm/vmscan.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/math64.h b/include/linux/math64.h index 837f2f2d1d34..94af3d9c73e7 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -281,4 +281,6 @@ static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor) } #endif /* mul_u64_u32_div */ +#define DIV64_U64_ROUND_UP(ll, d) div64_u64((ll) + (d) - 1, (d)) + #endif /* _LINUX_MATH64_H */ diff --git a/mm/vmscan.c b/mm/vmscan.c index 4375b1e9bd56..2d78c5cff15e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2445,9 +2445,11 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg, /* * Scan types proportional to swappiness and * their relative recent reclaim efficiency. + * Make sure we don't miss the last page + * because of a round-off error. */ - scan = div64_u64(scan * fraction[file], - denominator); + scan = DIV64_U64_ROUND_UP(scan * fraction[file], + denominator); break; case SCAN_FILE: case SCAN_ANON: