Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4142263imm; Mon, 20 Aug 2018 10:30:57 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzqWYhSdsAtrwx3MPfRVocB0Qofb4ZZavQsVO/7kRVpmjxKhIJ1RTzN3XQj/p/M/K/Ynr3I X-Received: by 2002:a63:cd02:: with SMTP id i2-v6mr43032901pgg.93.1534786257319; Mon, 20 Aug 2018 10:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534786257; cv=none; d=google.com; s=arc-20160816; b=sTWqzW8dw41T+k+gr4HavAdAiihK3BQkt1EOE3vl+BQ76zA3sUyn2Ad5Srt3HsGBNy 9ns0qRTAcjq8GKOwiMkxQe9Bxw5jSuJ8AtYDOQc+zGwegBe4tK7qHh1GzgxbqPJ4kjHW oSsQD8MVLhe48JMpfl+h4+CQ/e4X0nNKuCM+p4kueks9ocAH6o9Mjb9MGHuZZR0w/7mR faitHCw9GEWu55KgU9i31cmPVa26nwJ+dojzaWCOxW+l6ixViqHbdTQnd0x5iL+Vmww6 0Vmy1EpeSvdVoJK60uunOWuj3GjquKeLMqbSorJRndX1j48jzJe6Axo411t/bjpuuFqW Re0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:arc-authentication-results; bh=mCLJpbv+NAj0yQPLfmpM91REzOiU5CRCNwY/dacZQqY=; b=np07nZvFUshy1mOVAIz2M8G7bKG/gK3qwt4ZaTkfMBSAlRyQ68gPQP3SyrAsTh2OOC w0WkgwKCTSGvEsR1qXTNlUyFmJzKkMPZ1gv7xLffzON/QB9Ei/bOA/V/TzHoRvoKLKnd 7d9IVoDznnWtLxyL9PuFy4g/MFQakoFQ6e4tSnRHMXcrJZPBo3MU/j0NX8SDb+VazDdG u5n+daMNQrffCaVo6GxmcMlWr3LK67KfLrd+8EUgR2V2bF468Mxmsdyv6IsFUhv1gYXD duzUKnUSpWOLgSbk9IXYpg9U2V9pjTbsnh/exCfRKb7y8ei5kptbMJv+060G/7UuTuPL tG9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=N02bLtGL; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=ZUknUpSB; 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=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m129-v6si10614999pgm.629.2018.08.20.10.30.42; Mon, 20 Aug 2018 10:30:57 -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=@fb.com header.s=facebook header.b=N02bLtGL; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=ZUknUpSB; 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=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727569AbeHTUgS (ORCPT + 99 others); Mon, 20 Aug 2018 16:36:18 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:35938 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbeHTUgR (ORCPT ); Mon, 20 Aug 2018 16:36:17 -0400 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 w7KHHNOa032049; Mon, 20 Aug 2018 10:19:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=mCLJpbv+NAj0yQPLfmpM91REzOiU5CRCNwY/dacZQqY=; b=N02bLtGLEcsQWw5VAVxtuSOPLQyoYF0F2tB5oexPc3lAb96+lv9lzuRLYF5HMhHdDsUB zflwJEms8w6Vx8WSw3HQUZen/l/xQQr1SgidvvTx2tJWJiNW0zFr0Lq/acBuYe1JOQ1R rEFh5QqnZECKVfqNmPXWTzg+0NPAzELjt4A= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2m01bt047s-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 20 Aug 2018 10:19:16 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.18) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 20 Aug 2018 10:19:14 -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=mCLJpbv+NAj0yQPLfmpM91REzOiU5CRCNwY/dacZQqY=; b=ZUknUpSBF9K8UZ8bRIxayj4yaaXjgT4V9tEElZJ0AOWFvgDAjmqyewQa01pvhuHvRefMUsVg0cjwk6HYWdTUcqg7t5SNeVorhJWrAqZP/lJZBwKBIRuSZkdR3hQaz21HqJ61YzuJRBsnEU3JaeMrPZqDZ5L6oS7qhdCXPOFXHgE= Received: from tower.DHCP.thefacebook.com (2620:10d:c090:200::4:6489) 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; Mon, 20 Aug 2018 17:19:07 +0000 Date: Mon, 20 Aug 2018 10:19:01 -0700 From: Roman Gushchin To: Matthew Wilcox CC: , , , Andrew Morton , Johannes Weiner , Michal Hocko , Tejun Heo , Rik van Riel , Konstantin Khlebnikov Subject: Re: [PATCH RFC] mm: don't miss the last page because of round-off error Message-ID: <20180820171855.GA3993@tower.DHCP.thefacebook.com> References: <20180817231834.15959-1-guro@fb.com> <20180818012213.GA14115@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180818012213.GA14115@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Originating-IP: [2620:10d:c090:200::4:6489] X-ClientProxiedBy: MWHPR12CA0054.namprd12.prod.outlook.com (2603:10b6:300:103::16) To BLUPR15MB0161.namprd15.prod.outlook.com (2a01:111:e400:5248::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b05ecf5-a2ef-45cf-4229-08d606c10a69 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:Swn995eu5xGcDiPsAhYxLCSLmcplXMp46RUgidgDsNZ9HBCoqsXtKJTSaXYWU4glaecBmuv3JGLwlP+zj6qR7Bcfbejke5tuCyZFFwisC70T3cq4VkunBvopVABLBlLVQnFpEIxPAag1YDrZbBMclsZsXv76McMz8AXuvySy7TKR9gwxAikcaIkoTzdeg+4kkZPUawuEsSfo3XEuIGna7UJm/cT1GDg/15EmN4hQJxXMOJd+1V8TL+/UxN29rTke;25:dP5ncRi5mxuhTamSt1gfJoVClA+2zpMEFsnOCILAl41u2kocCAwyOObKKECmEDXIAlAvDWmSriHBWKOkzJql75v+dBrNnP3NwBTHo1gEpi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+c9M3wjNjKbHieNMChdsM0sZvV3xSvofg7VOA+ERAqrHo+SbTKD+MTLkxbmSGcSj7vG7X5wcyVvaxBF7OD+5b7lobKMXWkQqpT9FEq045KjLkn+uVjWIuMkTaXuFYZAAWPjBNdIIGUQI8wMe+7a2POmIDwdZ4N6WAEc7i1rcugu1M07vas5q4Og891AVRU9Aqh+O19bfzAcps0s1eKY9MGiQrJLbez7kKe0hzS9o2rWHreaK1mhfW7FBkeTalVOkA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(10201501046)(3002001)(3231311)(11241501184)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201708071742011)(7699016);SRVR:BLUPR15MB0161;BCL:0;PCL:0;RULEID:;SRVR:BLUPR15MB0161; X-Forefront-PRVS: 0770F75EA9 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(979002)(39860400002)(366004)(376002)(396003)(136003)(346002)(199004)(189003)(76176011)(6916009)(6116002)(2906002)(186003)(16526019)(316002)(54906003)(16586007)(58126008)(229853002)(5660300001)(105586002)(106356001)(52116002)(68736007)(50466002)(52396003)(7696005)(23726003)(46003)(8936002)(6246003)(1076002)(81156014)(81166006)(47776003)(476003)(478600001)(8676002)(39060400002)(9686003)(4326008)(86362001)(53936002)(486006)(97736004)(305945005)(33656002)(11346002)(6666003)(55016002)(6506007)(446003)(386003)(25786009)(7736002)(18370500001)(32033001)(42262002)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR15MB0161;H:tower.DHCP.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: =?us-ascii?Q?1;BLUPR15MB0161;23:gN6Z57ptrUmdSPPY3IOUbYWNMZXyHH+CzZJ1w5nts?= =?us-ascii?Q?1yXkOHsZo1ASd9GHXsy1DIhaf4GkvLEtoQjluAVLd0b4oCzzevhmr7/lzLIj?= =?us-ascii?Q?8GpRH1xCdS/qKeSD9NtxK4hLo+ei7O4GGtS+XcUzmCkEpkJHhnGmJmszsb+s?= =?us-ascii?Q?HpCi0qy981XemhaCDN1WNtGFV2pdqIcDoONN79pZ58+w90QNS2fe5LrkB6Y6?= =?us-ascii?Q?XQdLts+PIvq5PykTy1rwThhOWOFL6ixSSKAE/EAyCUqu2yQonWs0U2QW6OTK?= =?us-ascii?Q?YBAE4/km4SSb+V3FoFlhzf9qfi1XG4ZYcO9jp2w5ZkDYiEWlDDXyw6UoG2KN?= =?us-ascii?Q?E4zyXNaiB+96Kj/a997n/Nb5QYaenz6KjzJTxYsyT+KVdw4gElyfDyo7YUpJ?= =?us-ascii?Q?3CrjNZ1Qw9zheCWQJ18kdKQjEyuHJqo4HKz3GAIbqgemPgT0Xv0cPbTxupjd?= =?us-ascii?Q?k4aJmgi8fqhEJ1V3NuqMIbqya/xYWhgpEuHvo0m8ssWRjTk68dyXDlnwT1q0?= =?us-ascii?Q?9miwt+X5zbIaDmXvUzZAi7VtVmdKzA2/+epDQ/MVMcQwAgqH9fFnFPMcmjrK?= =?us-ascii?Q?DJ2EvSpdA2WUmQxMR/o0slWk3cWclFRVyw7ouaoJcQjg1Xncp0wfy49tIrn/?= =?us-ascii?Q?a3rgsSV7zasizasELkXUTNvx2L0K3MTQ7BJRZNomOU605/GXkeIMS5rHY6pa?= =?us-ascii?Q?vui8ohzjIfx/ItaU12VHA/DL5VYd4KZf1r08RrfjM76B0IqSN/GXDZrCq2IE?= =?us-ascii?Q?kCVPvJS/sx4JOJCIP0j/c9v3vnyXNl268rB/MzBteMUG4MG6Ek8xsbU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CQj4i/o0F88Voq7WspICypo/yd0aPOyEUE9ThNnRPQKMra4= X-Microsoft-Exchange-Diagnostics: 1;BLUPR15MB0161;6:TwOAkziruW37fUkWB8VMLzh82C8oCz5Rfds294jRB4mX20NJfe9dl1B3na0UBjIQMQA5zsynlA4FFy2m5/FXdiozkzsODg+7DWxLu98l5wtewhE2iLcG07Js9kkNmrkwMU9xg3e5lNgvumik5aIw9QNkfTwVrvWwl4DRpVdxTQKRR6td3wo9p6Z9VAoW+kHOkkr1NNfrYUHrOI109lxCb28QveH7GMrK3ckj6YCCoKWLoo2cNG+6t1sIJ0UHTECFPwa/KDA06lQ5Fou/JJ8R0TdeFAA3GBpzjiuf0bh8tyzifQeku25x45JFy8gzokWqj0b6AHkrRgW1T5wKcL1IWXMtH4VQYI1JdcZaCtzrpc1ULLMalZFwFgOEJHUxzTkp+pO8k7aC5p/1uRQKYGIduvhf76b74ga4l1bxGTSQ+VuZgj6+0hvpb7dDhkoW5usiptqMl+adrHR1djV2y9wtYg==;5:4GDc8gd2n/oFjMQ2LchQ2LJUvXQfxn5AhutJseQvUPiF2qgdNANPhtyLj8wDQnV05hV/wYAaQQDg3Roa8CaX8tLW467wQBKQnE9RQsZf4Yi/a2ebpQ54MLOH6YebtxSrb/2rbXNlin2wSHoDMVI8bDI8DeyshyyWUU/WcePs4qg=;7:qkXGekpnTazEWshRsU5Fkau+DhVIWJ8DhgozOHtrE0zVKktqDPfSsF0aID1plklYmAY49Ur1UOcdcjsZayZ32tJ2yT49iAmrb9J7j2yNS2oieN56chWmuTZmQjlEDA02yKF9v89uFGVJj1Phq74lpSrCMOYmJrHwp2MU0zHAho7S9oZhIhmbdNlpf3vE1tJ9Tcl9RLVNURx4FXKlRReQMc9YZBRUO66VxE9DKLQUQFfWij9tDEhY0JbO42sfFB7X SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR15MB0161;20:nramqdahfWS13y9mFh2ZQbL6rCAlxVSGPXIWN/ZWSkKkU8fAuyyAzxIJlzKJfie8+0lruEl2xNdt2RBGvwN/Ifa4l/RZrE8uoP3WbTDZtGOUeFjkxAuRCZCOB6aYkJtqHe/wJuzB3SQntsldkN2IcEo6Bx3O3z/Uiqm+XYaf8Mw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2018 17:19:07.9707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b05ecf5-a2ef-45cf-4229-08d606c10a69 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-20_05:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 17, 2018 at 06:22:13PM -0700, Matthew Wilcox wrote: > On Fri, Aug 17, 2018 at 04:18:34PM -0700, Roman Gushchin wrote: > > - scan = div64_u64(scan * fraction[file], > > - denominator); > > + if (scan > 1) > > + scan = div64_u64(scan * fraction[file], > > + denominator); > > Wouldn't we be better off doing a div_round_up? ie: > > scan = div64_u64(scan * fraction[file] + denominator - 1, denominator); > > although i'd rather hide that in a new macro in math64.h than opencode it > here. Good idea! Will do in v2. Thanks!