Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1398983imm; Fri, 17 Aug 2018 18:23:39 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz5FMal8HSBXy5fjcVacPCgOkb2unD7bqPbAdbkfbP8q36YVqZAkav7VHYEuD32KmjxHUJp X-Received: by 2002:a63:d704:: with SMTP id d4-v6mr34996817pgg.312.1534555419116; Fri, 17 Aug 2018 18:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534555419; cv=none; d=google.com; s=arc-20160816; b=uHUgSQzU0S8ocjMY1gL0lbqG1YIBcREu+q4sv/D7G/k+ffEGJZA3ubVe1d/KhwdDah 0rwxPxObEXa2MNgpOTWspmaRmkI+v4rdndk9X+/iJzAgVsjntp0oF3wTJUY2s1krpfEK RF+3g66Ag0Rnv1wysChKW6HatsTwYeRPNy0/HOjESQAQSqnMfM0laRUgpTxou+BuxboL BPLf3h/Jz047M9irr/hIFzcaM+PvB3oWzRKSIM3AwraXOiqbb3oxnjkTDylq9mo8lltA kvxJfhMSghsUl8Mong1BiYKAD4ajAWI91s4rH3YBl6xGZ5XA3cUmfnB1q6gH6FRFjo0R xmHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=s9lr5/rBgfnFNqAAxR0xbQmN+jsipj97rBqkDfrabn4=; b=w+vMp9GA1WFhDhgMJai8LCg5LZlBuNOlRTvK3G9jV30OF4KrrIAtwdAhPSIE+XIiCQ 1dbyiLyaZz8M2EQBZvDncCLcO61l0USVB7EuI6VOtvIC7FClhlS0kanxKJxsIIkZEgtQ /jPLARXL/zHR3VVaMejQ/JhDFYNM6LE588N1Gp/1kB7bzHEtzGZD+O56eNsKyW6BkSrV sdLN9r5F3o3I/4OTC7qA0lY9WGcCTFdXSKbkR0pbrPLPLxdTFNPC3r97vzJgtntFpo9v tG4p9BmfmW3qfUpTAtugHx2wgaFxZ7lL31cMUnzKQOcS8hxKuOEFmT92/6VdOKMLMFSB Ds0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Z8wXhcKJ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r11-v6si3580859pgj.46.2018.08.17.18.23.23; Fri, 17 Aug 2018 18:23:39 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Z8wXhcKJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726139AbeHRE2A (ORCPT + 99 others); Sat, 18 Aug 2018 00:28:00 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54546 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725763AbeHRE2A (ORCPT ); Sat, 18 Aug 2018 00:28:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=s9lr5/rBgfnFNqAAxR0xbQmN+jsipj97rBqkDfrabn4=; b=Z8wXhcKJoJ9YyjTOQsDC63Rn1 ik8aLgUyOR078ZkAkXiviZZtN+cZ9veJ0UKgw85OviJlSHhgpFfAqE7vOrgqW6vMNA0INOLgfgICs CCUB+G5jJXhhCfcdK3R8QS21TXjN6hqQ9srUxsa28d+WHeJjTB5E5a3DD6bRS2OWkglPoF2pK8X+N yDyud04Ua2KQWw34e40BCsRiBhpFwRwKxbUQgJpb0TgycNpM/tZbM9Q3CAU8GwrnWexJwA6ae5yVJ B3KHTrcZE6Zv28O6ADr/ZrQZhSqg+j2ZcmqAKiwmNbOfE5kectokJlGlgmj61XO1Adexoy0D+70ZR J/W+7IB2Q==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fqpwU-0005xi-3d; Sat, 18 Aug 2018 01:22:14 +0000 Date: Fri, 17 Aug 2018 18:22:13 -0700 From: Matthew Wilcox To: Roman Gushchin Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, 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: <20180818012213.GA14115@bombadil.infradead.org> References: <20180817231834.15959-1-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180817231834.15959-1-guro@fb.com> User-Agent: Mutt/1.9.2 (2017-12-15) 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 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.