From patchwork Mon Aug 27 16:26:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 10577421 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 6A5F014E1 for ; Mon, 27 Aug 2018 16:27:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5620929418 for ; Mon, 27 Aug 2018 16:27:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53A6629AC6; Mon, 27 Aug 2018 16:27:39 +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 9415229A62 for ; Mon, 27 Aug 2018 16:27:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9CAC76B4169; Mon, 27 Aug 2018 12:27:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 97A166B416B; Mon, 27 Aug 2018 12:27:37 -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 81B196B416C; Mon, 27 Aug 2018 12:27:37 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id 5A4E86B4169 for ; Mon, 27 Aug 2018 12:27:37 -0400 (EDT) Received: by mail-qt0-f198.google.com with SMTP id l7-v6so16032753qte.2 for ; Mon, 27 Aug 2018 09:27:37 -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=5+LthTYFyo7iLSLe+0yUlHxKcSKZ/m1exZcyclpsPEc=; b=tQoKUtLUiqBhR9A5BGN5rORYD/XUh9egb8GKdt/Mr+InDo/EcT9ljYYp3cLNErb1Ic m73uj1sJ2PuAdfWmNbzC4+5FB2nCunDbwYjdJSmBLc18c9gzQiW6vu0UuR9CoY9rlTb3 EP3eUooPSB++dtjvCXX0c0B74V8LEAa7nEjFdiPuUx3iUwQbsMlqujqwk7tx1L7oygDd gFUsKFYhFvZz1aNopl8QEUFZ9myZQnd2wvOTz1IHG/dUtJ2DxgE7sD3hJS21w2/htcgb 6Jnzh+1St3N87Yh/vh6hB0Y/zdy+6YYEu9WjWdQNgXHk0hRIgssfwqvhbwLqgNRLbn96 QHZQ== X-Gm-Message-State: APzg51BOxSiJzVxp5O6fZbIyuhC+VJVnJyrkhSqW05qAIGqO8Ywc3lc5 J1T16GpRXj1NvQGbpBvcxMrxK4OmCqdbArcXSvXaUZersw9iOmEJvEeiOKk45M8uvLjCaSsvazH pGCVWxgt2yTRwJLrtK1ksjZFwjMuf4Y5zwmvJhJcmXSW9WUAy2QapSmPP44oLzzNgTw== X-Received: by 2002:a37:434a:: with SMTP id q71-v6mr13955228qka.277.1535387257076; Mon, 27 Aug 2018 09:27:37 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZb/LzQ9kkozbfq8NkNJahR3aucfu4kUz4cXZgSWIVP7QVL5/+1B53A2oJSJcWNE1EpWzly X-Received: by 2002:a37:434a:: with SMTP id q71-v6mr13955191qka.277.1535387256456; Mon, 27 Aug 2018 09:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535387256; cv=none; d=google.com; s=arc-20160816; b=XjJzcmllMdFQsY9o7fElab5LSM+ieqTxCKUqn/NXR7AoMe/e5CxT32UimJYH2QG+Qb 8QMgx32HFJ9T0ByIbZSDAstfyrYUCBmweJrnCdC/0PJesC1GMON/okynNADtVm2ZLVv9 za/XUG8XRCK3rkX57BZ2ykN8WXP4KwC3piyToq1mBMxq8vOzs8gyW/E07LETjWbbs4Jh OpV7B1E2EJlu21qLDu7utK2+my9shnYtaKSQPYgdKvG3QiVN2CnwGysHKNCsUTmZQs4X kzLRG7c2Br/VikBNNpXzzsRwLnRj4LEBvw7t9omE+e5ynn6aZ+gZp52boFUFVePPwzS3 Jvow== 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=5+LthTYFyo7iLSLe+0yUlHxKcSKZ/m1exZcyclpsPEc=; b=m/bc4R3OjH06dX1Mb6WxPokKaZDJe/h7pYrJuLbvCg4xpIWIgLZFfkOgPZ4Jrb3lXW 1VKmGo/c51Yn3Py+T6Tvw1637R02WDA6UJ3iZv6dgYVXMHc767efT94VMRJVLx2/wpp4 PfGcBqTSOkfbOQeDp1qjoEM0oJwWWTzsALsdBF473rggMIf3s1q7fPny++emdKcFoW+/ 0rN9RylEKtyXo6JviABHLIx6ED7iJwcy+7CoVGtG+v/YFoOvOk/ymoUtB8pSg8QeK8hR 5gJtNHy6vqVpri0hycqb9UJd12PITkQNR7Pbw+ymPtXuTvLmg1rcWmBmZATSDaB6ib4o nV/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=CJIsTT+S; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=KlfQ4Rap; spf=pass (google.com: domain of prvs=177771a572=guro@fb.com designates 67.231.145.42 as permitted sender) smtp.mailfrom="prvs=177771a572=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com. [67.231.145.42]) by mx.google.com with ESMTPS id s17-v6si2943309qke.302.2018.08.27.09.27.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 09:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of prvs=177771a572=guro@fb.com designates 67.231.145.42 as permitted sender) client-ip=67.231.145.42; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=CJIsTT+S; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=KlfQ4Rap; spf=pass (google.com: domain of prvs=177771a572=guro@fb.com designates 67.231.145.42 as permitted sender) smtp.mailfrom="prvs=177771a572=guro@fb.com"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7RGHr8h029248; Mon, 27 Aug 2018 09:27:08 -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=5+LthTYFyo7iLSLe+0yUlHxKcSKZ/m1exZcyclpsPEc=; b=CJIsTT+SUoZXAPbNVAStk8hdoDVseK3hE1eWzZDTJeYCcXOdayNMF5asy3dmr6JqxQsv khMMuKM93pfND7g06t4UwSyI2RA8bWowcNkk00TdTiRwHtZHvDdVxJlHLFwAp0F3T6zN Yar0aNgVIgnjBj3E7v13sb/Y0eSsBt/ui18= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2m4m8nr487-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 27 Aug 2018 09:27:08 -0700 Received: from NAM05-BY2-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; Mon, 27 Aug 2018 12:27:05 -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=5+LthTYFyo7iLSLe+0yUlHxKcSKZ/m1exZcyclpsPEc=; b=KlfQ4RapWZe8e8OGtlkLY1S8yRcCSWibgWMIQ2zoF6iAShjEq/vDIAr6biO08d077Un0OXsBTmp/jjpfNFr2GeMyiFYeCz0MZ/e+9q1GnGzE++5QDUhn9kzSP0z3DrCiBwsOL9+Guz2ycvfKrki2PKmPpiCLLheMN2if07iVSeQ= Received: from tower.thefacebook.com (2620:10d:c090:200::4:4b2f) by CY1PR15MB0170.namprd15.prod.outlook.com (2a01:111:e400:58bb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Mon, 27 Aug 2018 16:27:01 +0000 From: Roman Gushchin To: CC: , , Shakeel Butt , Michal Hocko , Andrew Morton , Roman Gushchin , Johannes Weiner , Tejun Heo , Rik van Riel , Konstantin Khlebnikov , Matthew Wilcox Subject: [PATCH v3 3/3] mm: don't miss the last page because of round-off error Date: Mon, 27 Aug 2018 09:26:21 -0700 Message-ID: <20180827162621.30187-3-guro@fb.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180827162621.30187-1-guro@fb.com> References: <20180827162621.30187-1-guro@fb.com> MIME-Version: 1.0 X-Originating-IP: [2620:10d:c090:200::4:4b2f] X-ClientProxiedBy: MWHPR04CA0045.namprd04.prod.outlook.com (2603:10b6:300:ee::31) To CY1PR15MB0170.namprd15.prod.outlook.com (2a01:111:e400:58bb::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c2a5f6b-c76e-4307-1280-08d60c39eb51 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:CY1PR15MB0170; X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0170;3:liS0mtix+WurjRHFZec5GVp1qGTaq+gEz+xOYAlPli1098JQ8gS7lbQx8VIOjrcg0uWdBLds+s6YuuhCNiAaOrJUABjR5pWvaG2XZkkoE1kgnvmg6o8imS5nPK7X3zX1f+K65myCL4nYlBy9VEm8y7ppHdeJaPSmicqMBvVfbnFj2vOwXdXGNsI2SmwpiPkaJWfhMuvPd3S95uSdUpywlHl+kyxat1rq6ireXNNN0JjtVTSOr1UpuYzKNAyKs64z;25:q2PCPtHkrxMjTJ3LwGp+2c6EXlv9ukV5ruNUt7FtDPv9e4wr+rmhycvEONS/mjObN5+rs+YKhrmlAdv7hQxQbwNPZEnOj0UjGi+WHuNwvwAVE7Qq3sVJHUf4Up9TZTuy3Re7j0WeTI/8i6SIaalLp+5lXsWzUk8outsLoou5Qhrlh9lkqeprh53H9sz7vloo+NlDWuiJLxuBV4CImVPCbUVLyeYRoIOKsAdK7Y5QEhq6Tox0TCuPPplBUarA2Tyf8yDBQTV5DFx92NzujI1zx6afPnOPu9vr+TWh69ri9bHUqVzOvvWS5O1yVhAJQShRMPPMb5RSXMCzb2WkT/P2Ag==;31:+m7RyNPEpiW7mOasj/T/lNoGth8Cdf9SYz9SU+Ads8CEqeopbEmAyDyglVJZEw/NFW9tyUWyf7nsQI/yRWekc+iTrRkw07DVszXla6sDY+FAFOwgSTkwfN8hMErCdC98GootrKm6FJBac9VGoo+x5MMP5Q7O1KhBxYQ0eqnjWoqHOYswCtkDWdJL96BsVrTo1GlXbBxW02kYjkUCJtzOEPVazbtNJk6vqxokZ9qz1dU= X-MS-TrafficTypeDiagnostic: CY1PR15MB0170: X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0170;20:j55lwM0oqQ9cXGYKIkTQnPrAkOdyGeBod9701TR9RyhMDJxtK2avuudNNw+lJNqMvSHAMMp+Gt12AM31tmZvxpf4q9YkhtdEmWT1wD0IL1MIpANQ2Vmx1OSvWfAMl7qttr2/RD+qPsh5/hKGRmnzAupBJTWOhjcA2nL6/x/EpIzHNd6la6BYyRe7umXWF3Xyxi23Y7uSx6zTkSnNXYNFtN21iMe7ITuVqYaUoCftUB5f8kd1Caj1tQKb2upFD54klIdHfiwy7u33/fdaTQuNJQSB8ky2fRuDn08Jte5hiqyVJvI86Ghg/5T57OdmYkU/8YkzPdoiDitn4btwaQW4YjTnBi9Prn5qYXOC+AqjO3JJ39gS+ttk/Jr0Z8+Wv5ekNlgxnAohCVN/rp11Kzgg3Uy5DOCH7bYWlA2s6dgLZnxi7gHVHlL+6ydatHnjr9N6R/7DQh5C6VxYWxKuTMpcIi574CAtgzamZvtYGPKArEr46MCwMohfAbgKOhMFQ0j6;4:H2vvC0vZJDdQor8u8CmPbKxgJKxnRtY9/bYbZzjXSPkEC7B08rBrDguM79fbBW9CsQLlLJh9A2nr45t6ewjoPwAl2MlpX2wKt78+sGQKQReRb61I2gykO2cOo47o/MPK6idtaO3HOAbUf1mJqa4uV52R2IwJcjlnI+JKOlXPEPe/MtxZ2TLEIhIduUs0Ha/G9/PSd2if+LgLdthGSegjNQUVsF1Ez46tOBM8PgoP2ro3QSGvllEbybcuCQOHFbbWajggJTaPMzhVX2RQJK1uAgXJwl5TQQ6q5B8T6i8o0GFep7mdc0K5Qj70Tjd/cJm1QfWglgtOp3dAkO7unJwUnM6gkxXP4WtQ5TKAu2EwV/g= 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)(823301075)(93006095)(93001095)(3002001)(10201501046)(3231311)(11241501184)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201708071742011)(7699016);SRVR:CY1PR15MB0170;BCL:0;PCL:0;RULEID:;SRVR:CY1PR15MB0170; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(396003)(376002)(366004)(39860400002)(346002)(136003)(199004)(189003)(8936002)(16586007)(97736004)(5660300001)(81166006)(316002)(81156014)(76176011)(6916009)(6666003)(54906003)(6506007)(386003)(186003)(16526019)(52396003)(52116002)(53416004)(51416003)(47776003)(2351001)(69596002)(1076002)(105586002)(6116002)(106356001)(478600001)(46003)(8676002)(11346002)(2616005)(476003)(48376002)(50466002)(7736002)(2906002)(486006)(446003)(305945005)(36756003)(68736007)(7416002)(6512007)(25786009)(86362001)(6486002)(53936002)(50226002)(4326008)(39060400002)(2361001)(32033001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR15MB0170;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;CY1PR15MB0170;23:bKWeAg8q1/aa5Hju/73fSn45mOVLGvfcwdEc8VNWuAgNQo30ioPUFBV4Ki8xy+5Xz/0Dq6CNWz8oC4PqGrQtFib/rmOAlUuzZ9FqGPvnC5qIMQ8+gcLQgOH9hMTZoO8ceGBFCVtVTRgOlOMDjDZLXN3DQ+d6Ll0s1HZ98CMxW8p2CW3YiqAO/kSlxmxwcN6i0NGFLtJFwwdP/qI6QTXginAUnbde/le5NxtPX1SmoPe5EofOgDSwfsHDdQZM9B7OHTEywRwRrl2IpQGfMY0u7/YKTymTDXlkMoEUk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EE/KaSpBUVnqLAksIGHvD9atSOdfOygWEvFfBqECfNjJgoiXJLoqIBFqkcK2yDCvFk1CvBg5gVmrfBBuTLLoQkK8rYCJS3+YiVqy2sFRhgXYkBd/ucxqM4Ymm1JpqfrLn5cBABqSJDcVDQ9rxpbZyqDM1KzRw+XDLtiExNomzaDhb4+PPeWgzlzY5pE19dhEFk+Zu/iwVoWm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0170;20:vEVxW970IJwbt6/R4QbwdPnIfGGYpZ6aKIFxwki0oZnBfiDEbWDCBrTHsZlqg23F9+/geLHmocFAGetRQo5SsoEho2tSYEmg4prKqA31z3AsDy/ChwHUPT8qsoF+fUAPgc2Pp7Nr/5bwg0u7MpIhRy9OwoXtUA+9GIt0TN9CdH0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 16:27:01.2944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c2a5f6b-c76e-4307-1280-08d60c39eb51 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR15MB0170 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-27_06:,, 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 Signed-off-by: Roman Gushchin --- 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 d649b242b989..2c67a0121c6d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2446,9 +2446,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: