lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 5 Nov 2022 19:09:22 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     TGSP <tgsp002@...il.com>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>, xiongxin@...inos.cn,
        len.brown@...el.com, pavel@....cz, huanglei@...inos.cn,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org
Subject: Re: [PATCH -next 1/2] PM: hibernate: fix spelling mistake for annotation

On Fri, Nov 4, 2022 at 8:31 AM TGSP <tgsp002@...il.com> wrote:
>
> 在 2022/11/4 00:25, Rafael J. Wysocki 写道:
> > On Tue, Nov 1, 2022 at 3:28 AM TGSP <tgsp002@...il.com> wrote:
> >>
> >> From: xiongxin <xiongxin@...inos.cn>
> >>
> >> The actual calculation formula in the code below is:
> >>
> >> max_size = (count - (size + PAGES_FOR_IO)) / 2
> >>              - 2 * DIV_ROUND_UP(reserved_size, PAGE_SIZE);
> >>
> >> But function comments are written differently, the comment is wrong?
> >
> > It is, and it is more serious than just a spelling mistake.
> >
> >> By the way, what exactly do the "/ 2" and "2 *" mean?
> >
> > Every page in the image is a copy of an existing allocated page, so
> > room needs to be made for the two, except for the "IO pages" and
> > metadata pages that are not copied.  Hence, the division by 2.
> >
> > Now, the "reserved_size" pages will be allocated right before creating
> > the image and there will be a copy of each of them in the image, so
> > there needs to be room for twice as many.
>
> According to your interpretation, the formula should be:
> max_size = (count - 2 * DIV_ROUND_UP(reserved_size, PAGE_SIZE)
>                 - (size + PAGES_FOR_IO)) / 2
>
> Am I right?

No, you aren't.

The formula is fine.  I've attempted to explain it to you, but perhaps
it's not been clear enough, sorry about that.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ