From patchwork Fri Aug 17 23:18:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 10569425 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 C3B585A4 for ; Fri, 17 Aug 2018 23:19:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A68582BEAD for ; Fri, 17 Aug 2018 23:19:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 988202BECE; Fri, 17 Aug 2018 23:19:42 +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 531CF2BEAD for ; Fri, 17 Aug 2018 23:19:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10CA56B0AB8; Fri, 17 Aug 2018 19:19:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 094796B0AB9; Fri, 17 Aug 2018 19:19:40 -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 E9CF36B0ABA; Fri, 17 Aug 2018 19:19:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by kanga.kvack.org (Postfix) with ESMTP id 793856B0AB8 for ; Fri, 17 Aug 2018 19:19:39 -0400 (EDT) Received: by mail-lj1-f200.google.com with SMTP id q188-v6so895378ljq.22 for ; Fri, 17 Aug 2018 16:19:39 -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:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata; bh=JwnQ//iDGj/U4pEq62LtaL1J9jgb7d7UJC1X/cTmk2I=; b=qMB6ZoSwtrL+7XcFfJFbckvtvaVwa4m3WEvj2ZEae/7wFifM+TcL4bM4cH6r5nxrl7 cryms9xOG9IUmmBtvFUPeh8Z6+U+/ux9fjp6IKCamDgv5yGTFxajc5G7lwKRwlBnErD/ Acnf9QHYLnuavycB+e0UToePZMz4O+jqtFqb00kIt0h/c1bMO1Jf+nevd5Bz+4rC5bqu IIC7K43kzidE1cnjlowMtD/2qGUOjWPhXLk8MJNaXwMmTjHOf0WNVKVO1/eA3lNjs66D NFr9F8hxGMygOZpj7Tc56b/fpWwegoZz8V3ccyexPEp+Pe85UZcWWBV+2C9zoNQjEaPx 4wTg== X-Gm-Message-State: AOUpUlH5lBT1QjEOS0qWGDfrS3ti40v+3q7CMCd5mAYCpRBWkmiZiSQs 373TmCG7aDtWlVZPV42vGH95eg9OYrJTNCgcBUTF201SNgn4Q8Sa/BkrTAcB5A1SjcD8UKKpEkt mPz1J3zSNXIvZcxYYU8ovBNn3OlLi3qgkMSq7qp456FUD5FT15pckUv0GRBqEivDdOw== X-Received: by 2002:a2e:498:: with SMTP id a24-v6mr26495786ljf.27.1534547978575; Fri, 17 Aug 2018 16:19:38 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw2IqfynhJDCaI52pdc0jIC0xeja+3HF0xTvPMk41IYSGelMJEMb5FAMeg2jkaeS5T2iFyF X-Received: by 2002:a2e:498:: with SMTP id a24-v6mr26495775ljf.27.1534547977765; Fri, 17 Aug 2018 16:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534547977; cv=none; d=google.com; s=arc-20160816; b=m9vsmv5/sAgbbSWRl+45bT3VZW3TBYXlcVwoWppmWqY/aRbEnEuq/k4yR2st2/f5qs +m1NM3NaG4sWdQZIGjsu0bOTf8yEWwsVxkakBD/eu8IwIoiOXso/xjedDj3QSqRhEpVy kd1CZmCvGLEDJsnsuZ/DN1CbkVoVvRQvpNLDBxkrIqzf8MAGlmEbQMl2AdSrsybOi7Av Y763anX58o5/n80lbOkw3bDHdueIsGL2vGJyZHN0ixY/TSxh4s8b/deTTms8ZV1xcJSZ eNDiP6dZvc/+JsAH9qggCDGKGJujQzKwY3/DYr8TuOav9p09CPoL8vKoGtfm0txYBvDo +8iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput:mime-version:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature :arc-authentication-results; bh=JwnQ//iDGj/U4pEq62LtaL1J9jgb7d7UJC1X/cTmk2I=; b=Mzf1u0C0SjuJ82NTAuMi6EWeBvUwLTpxlFxLK9p0gxGl1q0jUfrx9fEWc7D/o6jAxq 6pSQ21VM/zzgZ//9stAy/moJqD83dE5GTCfmQve75oVrW9CdUJHozq3yl/NoR7CJ6sUI 7yPmisKYX0in2rrtOUfYpN23r5Mvx/MIWVoczp4tcoWiPKKeO2ets8ttQ5Cr+Y3FVbn5 yNZCZ28nJtXaZlGC8lLJZM9eHxnxngxut+c8pJ3nfnSjEcnAYCd98fEEGk1s+my9PTJR InsNPI2Bxr7Ei+zLRl4Q0Kz0jkydqS0nvD7VKj44dRC/z1qzY3JpnzXM98lgr0LeScOa 0wKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=lLoJnYgE; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=c2Q5Ddgf; spf=pass (google.com: domain of prvs=1767316b71=guro@fb.com designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=1767316b71=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com. [67.231.153.30]) by mx.google.com with ESMTPS id o65-v6si1491603lfi.365.2018.08.17.16.19.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Aug 2018 16:19:37 -0700 (PDT) Received-SPF: pass (google.com: domain of prvs=1767316b71=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=lLoJnYgE; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=c2Q5Ddgf; spf=pass (google.com: domain of prvs=1767316b71=guro@fb.com designates 67.231.153.30 as permitted sender) smtp.mailfrom="prvs=1767316b71=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.22/8.16.0.22) with SMTP id w7HNJ2k3013162; Fri, 17 Aug 2018 16:19:28 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=JwnQ//iDGj/U4pEq62LtaL1J9jgb7d7UJC1X/cTmk2I=; b=lLoJnYgEaCYeWdLMapt+RLtkeeywFmPRn/ojvxlMX4sYkwViAyL2++Vl1wBAEBgbREKt cSCOg16ouvLhOcDSnRpUiBH2aRUcM0fGFVqo314HeM61ksIPFh65LvjWUxalRYaj1nj4 kxTtKablojA3iLK5MCxlEa7ItPrzGmrAe10= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 2kwxebskvk-7 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 17 Aug 2018 16:19:28 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.16) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 17 Aug 2018 16:19:08 -0700 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=JwnQ//iDGj/U4pEq62LtaL1J9jgb7d7UJC1X/cTmk2I=; b=c2Q5Ddgf9+DboW+u04cbtkfJCocZ/4jYvi0RhYTOvSdNTlYBNvGiFPN1yia/GQkN2quHx2PszyW0EhbDD4iJoEErhebkZjTqBPSo9PQGnShZ74Eo4USurQpd1hWBhNk6fEpRyJa/gkx7XtMfFo+AMb1NgBY693nREUJRt0S5XMA= Received: from castle.thefacebook.com (2620:10d:c090:200::5:6176) by BLUPR15MB0161.namprd15.prod.outlook.com (2a01:111:e400:5248::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.21; Fri, 17 Aug 2018 23:19:05 +0000 From: Roman Gushchin To: CC: , , Roman Gushchin , Andrew Morton , Johannes Weiner , Michal Hocko , Tejun Heo , Rik van Riel , Konstantin Khlebnikov Subject: [PATCH RFC] mm: don't miss the last page because of round-off error Date: Fri, 17 Aug 2018 16:18:34 -0700 Message-ID: <20180817231834.15959-1-guro@fb.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::5:6176] X-ClientProxiedBy: MWHPR14CA0044.namprd14.prod.outlook.com (2603:10b6:300:12b::30) To BLUPR15MB0161.namprd15.prod.outlook.com (2a01:111:e400:5248::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab94a184-28fc-4220-00b0-08d60497d452 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BLUPR15MB0161; X-Microsoft-Exchange-Diagnostics: 1;BLUPR15MB0161;3:LOzCmJGOUUVeODJfwUHdeF9KDIWsSHwNjlMj9Xf60MOQB5htsU/RU6dnzdOa8rhh1S7avDpWQJkJUg+agHndCq5HsSU00eIh5QEvtD+3nhrqlo5a/gweHJAW395BSFRof+3NPhAilCAeWToTuoL+2GDTzJvIQqc+//ndnQstK8URmg9rJz/HgsumIvyJKT4QztshRvdmy4rpd37JMNocxrS3IswDmgjZ6nrGKoRRmDv4euMv+iidP/MpxORgfV9y;25:5PoMWE2QcB14pIoiCj803guytv5dintKMW4EZL+wRS6X6n6vYWS+6RMum17lCEoIFOfFuYcz7le9oMorzdxW8/A0FqltUsivq1XlfNwDL64TGB8PM/a5B6HM4jqhiikAiPqAbiepPFGrM9mLt2JEu2l4t8KTBIdcOV+wFM2ZXAMWwWsrtwaV2wieTEviZOHsWLm9QanxGXRDBRUYcSjm/Mh4Y3FMxSkz/FLJGHT9bMmqGyyVqfq8t4X0XiXyrFoles9N6lFdMs1CoIOu6HSRPAikNvnBL+pPftb/O3BaP1xOIjyUlCPpptozVX68fmHtj6AGxBJE67aOls6mDbJhWRh3dvOrsJS1fIKlFh8HDCo=;31:yrypMEVoiwiKomiM+wimHxiHJ/bWfZC7Wk6W5sA3DRZ1q/rh44gXOx4UIrsE/hsmCzd7LNIDr4fsrfqY+Y8z5vPPxunX+dvwUUJ7S+X9QEove+eT89xJh6mNwznk/Xqrp0FbgoubPMyMG9a9rKoVUtPKCjNFtUbAOhj4bplpjW4ZA+e6QfdOZAHgaCI75V+HA8tB9JcPZUpjLDWMNLVJ5Kk0BjOgxIx7KLlEprdx+nI= X-MS-TrafficTypeDiagnostic: BLUPR15MB0161: X-Microsoft-Exchange-Diagnostics: 1;BLUPR15MB0161;20:th/OhqQDrSm/PTu0nNvYd6tkbyoz34UCNU4Yp/9htHneZ9y5ozHqvVqkTwgc8q2kaoI5et0BorM+dfXKfysoFFyzzYQUS2KDNOLN1joT45mnoLDMld6KghVcA/TL4HFS/FIHazng1HAe5VIt82rQ9Dg112Z3GOISthCoMPWQl5CZoWl+qP/YHNEZHMS526iGV4qDu1DfEci3v/U3EcvL16J0QtqlQLzufAEsSRagIQP/o0gsVeb+EVrCVDyrByIHADQWXclI93AUCwjxuFtCilWA3OljRUITIg08gfPwyxFG6YJoxb3yKQeyv03QjUg3uMe0vfa9y8x1kUUlYZuebIjxR7z75iPIztWDTsyg37FOW8gt2SelD2uBLrPRSRvswvEuWzUgFrfNd+AuQXjCcoUhYcNn4b/SQNSX+DXSiTuuPKbZnuzuPQH93cG/Fk7c3ObMg+CTdPK3p/NCWeul9tyHPnl0Qi72/7bzsMSJIBaBVfbkf+Nai7ft5gE3IpO7;4:IPfyI/ROKB/ac7zE7rYU+ELowIVoMHRAR8djQdatpBDy3TqiEZtrxujGZuffOya/fFP6L6T5iI4DIJR3CyG3yakyUREGIjKVu9jCtAIOuRfF6dVNwbkTOMDE9JsrMozCLGeMZdvltgtHkmjKtmENOZZyTWYtdmLfw6odcsn6MsgA6dkRU4Ddkx9ZNgdINRixKOFX/rA9ODw2y2CZ/q5eHQKIKzswN/52QNuApdQmBtBVW2t241kH0PG3JySRHVHM/+C8Cy3oZk+FxmNharelICv+GddcuH2jmbmutG6b1Cz5Lw9TxphZqwgIvIb3r8J/6dSv1wGIzjgQVfqrvkfMxPx1iBn319Ymh98xOqYbac4= 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)(8121501046)(5005006)(823301068)(3002001)(93006095)(93001095)(10201501046)(3231311)(11241501184)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);SRVR:BLUPR15MB0161;BCL:0;PCL:0;RULEID:;SRVR:BLUPR15MB0161; X-Forefront-PRVS: 076777155F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(376002)(396003)(366004)(136003)(199004)(189003)(86362001)(39060400002)(6512007)(4326008)(53936002)(486006)(8936002)(2616005)(50226002)(81166006)(1076002)(81156014)(8676002)(478600001)(476003)(47776003)(386003)(6506007)(7736002)(25786009)(305945005)(69596002)(97736004)(2351001)(6666003)(316002)(2361001)(53416004)(16586007)(54906003)(6916009)(36756003)(48376002)(5660300001)(186003)(2906002)(16526019)(6116002)(51416003)(52116002)(52396003)(50466002)(46003)(106356001)(68736007)(6486002)(105586002)(32033001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR15MB0161;H:castle.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;BLUPR15MB0161;23:sRowkWS/SuvKD+yq4pgo4SoJ9qhkwA3+H1rHA0I5cE7WAwDcAjs+qar7XfYBzY+gnKncX3u8lCMn5H1gvCsVDEvv5hmZPU6vLPAwyJs9S/JpiRvhKvVIvBaAkl3hBbsSy+Qmd554KpkOv/J3gyv+oN32+ehBO3Wds8qCASCPs49luH/Xg7DIw2Wj0q6mxE4xkJCspEzDh80VHhDfoU9fs9FbOKRE1EPOV2NGcU7K5UI5OVrAhrr3VJYSTeDMqsT6bH5yJSq8BxwtgrXpY4JUhy7gG/SZGsQYdiaUr0LsESmiUQKd1xJ25B4Nr1dxsREv7Md0xwn67G44zfSCfQ2NjHl2k8pgP2W2ajhoqeYmxgquCpOIETc0nZ1w/GwRZVjdZdL8IqM6i6QL97qiviREDr3S44WoCwkDD/544Okkj/FIYUveZmTsv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OPfAbqaXH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR15MB0161;20:+YI0IY45h0VOKbf46BVlr+o+42nBfB2ctAJUL8j1kZPvlcsTBR+a6VXQHncCt5MPTioamZPDhQtJKso/jcZwIN/WUlZwK/hVnBn1fBgqiQ5Vq1D+opiVJElZcF+NnDWiYtuvxXlAo8wn1lf3jlN1ulo2kvEeJ9T9FfrJq0v0tkA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2018 23:19:05.5959 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab94a184-28fc-4220-00b0-08d60497d452 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR15MB0161 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-17_07:,, 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 skipping the balancing logic if the initial scan count is 1. 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 --- mm/vmscan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 03822f86f288..f85c5ec01886 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2287,9 +2287,12 @@ 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); + if (scan > 1) + scan = div64_u64(scan * fraction[file], + denominator); break; case SCAN_FILE: case SCAN_ANON: