From: Roman Gushchin <guro@fb.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com, Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>, Tejun Heo <tj@kernel.org>,
Rik van Riel <riel@surriel.com>,
Konstantin Khlebnikov <koct9i@gmail.com>
Subject: Re: [PATCH RFC] mm: don't miss the last page because of round-off error
Date: Mon, 20 Aug 2018 10:19:01 -0700 [thread overview]
Message-ID: <20180820171855.GA3993@tower.DHCP.thefacebook.com> (raw)
In-Reply-To: <20180818012213.GA14115@bombadil.infradead.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!
WARNING: multiple messages have this Message-ID (diff)
From: Roman Gushchin <guro@fb.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<kernel-team@fb.com>, Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>, Tejun Heo <tj@kernel.org>,
Rik van Riel <riel@surriel.com>,
Konstantin Khlebnikov <koct9i@gmail.com>
Subject: Re: [PATCH RFC] mm: don't miss the last page because of round-off error
Date: Mon, 20 Aug 2018 10:19:01 -0700 [thread overview]
Message-ID: <20180820171855.GA3993@tower.DHCP.thefacebook.com> (raw)
In-Reply-To: <20180818012213.GA14115@bombadil.infradead.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!
next prev parent reply other threads:[~2018-08-20 17:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-17 23:18 [PATCH RFC] mm: don't miss the last page because of round-off error Roman Gushchin
2018-08-17 23:18 ` Roman Gushchin
2018-08-18 1:22 ` Matthew Wilcox
2018-08-20 17:19 ` Roman Gushchin [this message]
2018-08-20 17:19 ` Roman Gushchin
2018-08-21 5:11 ` Konstantin Khlebnikov
2018-08-21 13:35 ` Matthew Wilcox
2018-08-21 17:15 ` Johannes Weiner
2018-08-22 6:01 ` Konstantin Khlebnikov
2018-08-22 17:50 ` Roman Gushchin
2018-08-22 17:50 ` Roman Gushchin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180820171855.GA3993@tower.DHCP.thefacebook.com \
--to=guro@fb.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=koct9i@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=riel@surriel.com \
--cc=tj@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.