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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbq8UCtvtRH7FZUEqvTxPQcoGbrKvf_mT5QHMAfVoYNNQ@mail.gmail.com>
Date:   Tue, 15 Aug 2023 10:51:24 +0200
From:   Linus Walleij <linus.walleij@...aro.org>
To:     "Fabio M. De Francesco" <fmdefrancesco@...il.com>
Cc:     Jonathan Corbet <corbet@....net>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Mike Rapoport <rppt@...nel.org>, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Ira Weiny <ira.weiny@...el.com>,
        Matthew Wilcox <willy@...radead.org>,
        Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH v2] Documentation/page_tables: Add info about MMU/TLB and
 Page Faults

Hi Fabio,

overall this v2 looks good!

The below are my grammar and spelling nitpicks.

On Sun, Aug 13, 2023 at 8:25 PM Fabio M. De Francesco
<fmdefrancesco@...il.com> wrote:

> Extend page_tables.rst by adding a section about the role of MMU and TLB
> in translating between virtual addresses and physical page frames.
> Furthermore explain the concept behind Page Faults and how the Linux
> kernel handles TLB misses. Finally briefly explain how and why to disable
> the page faults handler.
>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Ira Weiny <ira.weiny@...el.com>
> Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: Linus Walleij <linus.walleij@...aro.org>
> Cc: Matthew Wilcox <willy@...radead.org>
> Cc: Mike Rapoport <rppt@...nel.org>
> Cc: Randy Dunlap <rdunlap@...radead.org>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@...il.com>
(...)
> +If the above-mentioned conditions happen in user-space, the kernel sends a
> +`Segmentation Fault` (SIGSEGV) signal to the current thread. That signal usually
> +causes the termination of the thread and of the process it belongs to.
> +
> +Instead, there are also common and expected other causes of page faults. These

The word you are looking for is "Additionally" right?

"Additionally, there are..."

> +These techniques improve memory efficiency, reduce latency, and minimize space
> +occupation. This document won't go deeper into the details of "Lazy Allocation"
> +and "Copy-on-Write" because these subjects are out of scope for they belong to

"for they belong" -> "as they belong"
(I think)

> +Swapping differentiate itself from the other mentioned techniques because it's

differentiates

> +not so desirable since it's performed as a means to reduce memory under heavy
> +pressure.

"not so desirable" -> "undesirable"

> +Swapping can't work for memory mapped by kernel logical addresses. These are a

"kernel logical addresses" -> "kernel-internal logical addresses"

> +If everything fails to make room for the data that must reside be present in

"If everything fails" -> "If the kernel fails"

> +This document is going to simplify and show an high altitude view of how the
> +Linux kernel handles these page faults, creates tables and tables' entries,
> +check if memory is present and, if not, requests to load data from persistent
> +storage or from other devices, and updates the MMU and its caches...

Skip "..." for just period "."

> +The first steps are architectures dependent. Most architectures jump to

architectures -> architecture

> +Whatever the routes, all architectures end up to the invocation of
> +`handle_mm_fault()` which, in turn, (likely) ends up calling
> +`__handle_mm_fault()` to carry out the actual work of allocation of the page
> +tables.

"of allocation of the" -> "of allocating the"

> +`__handle_mm_fault()` carries out its work by calling several functions to
> +find the entry's offsets of the upper layers of the page tables and allocate
> +the tables that it may need to.

Skip the last "to".

> +Linux supports larger page sizes than the usual 4KB (i.e., the so called
> +`huge pages`). When using these kinds of larger pages, higher level pages can
> +directly map them, with no need to use lower level page entries (PTE). Huge
> +pages contain large contiguos physical regions that usually span from 2MB to

contiguous

> +The huge pages bring with them several benefits like reduced TLB pressure,
> +reduced page table overhead, memory allocation efficiency, and performance
> +improvement for certain workloads. However, these benefits come with
> +trade-offs, like wasted memory and allocation challenges. Huge pages are out
> +of scope of the present document, therefore, it won't go into further details.

Since you explain what they are, it feels they are in scope?
I would just skip the last sentence.

> +To conclude this brief overview from very high altitude of how Linux handles

To conclude this high altitude view of...

> +Several code path make use of the latter two functions because they need to

code paths

With or without the above suggestions:
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ