Skip to content

Commit 6e17c6d

Browse files
committed
Merge tag 'mm-stable-2023-06-24-19-15' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull mm updates from Andrew Morton: - Yosry Ahmed brought back some cgroup v1 stats in OOM logs - Yosry has also eliminated cgroup's atomic rstat flushing - Nhat Pham adds the new cachestat() syscall. It provides userspace with the ability to query pagecache status - a similar concept to mincore() but more powerful and with improved usability - Mel Gorman provides more optimizations for compaction, reducing the prevalence of page rescanning - Lorenzo Stoakes has done some maintanance work on the get_user_pages() interface - Liam Howlett continues with cleanups and maintenance work to the maple tree code. Peng Zhang also does some work on maple tree - Johannes Weiner has done some cleanup work on the compaction code - David Hildenbrand has contributed additional selftests for get_user_pages() - Thomas Gleixner has contributed some maintenance and optimization work for the vmalloc code - Baolin Wang has provided some compaction cleanups, - SeongJae Park continues maintenance work on the DAMON code - Huang Ying has done some maintenance on the swap code's usage of device refcounting - Christoph Hellwig has some cleanups for the filemap/directio code - Ryan Roberts provides two patch series which yield some rationalization of the kernel's access to pte entries - use the provided APIs rather than open-coding accesses - Lorenzo Stoakes has some fixes to the interaction between pagecache and directio access to file mappings - John Hubbard has a series of fixes to the MM selftesting code - ZhangPeng continues the folio conversion campaign - Hugh Dickins has been working on the pagetable handling code, mainly with a view to reducing the load on the mmap_lock - Catalin Marinas has reduced the arm64 kmalloc() minimum alignment from 128 to 8 - Domenico Cerasuolo has improved the zswap reclaim mechanism by reorganizing the LRU management - Matthew Wilcox provides some fixups to make gfs2 work better with the buffer_head code - Vishal Moola also has done some folio conversion work - Matthew Wilcox has removed the remnants of the pagevec code - their functionality is migrated over to struct folio_batch * tag 'mm-stable-2023-06-24-19-15' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (380 commits) mm/hugetlb: remove hugetlb_set_page_subpool() mm: nommu: correct the range of mmap_sem_read_lock in task_mem() hugetlb: revert use of page_cache_next_miss() Revert "page cache: fix page_cache_next/prev_miss off by one" mm/vmscan: fix root proactive reclaim unthrottling unbalanced node mm: memcg: rename and document global_reclaim() mm: kill [add|del]_page_to_lru_list() mm: compaction: convert to use a folio in isolate_migratepages_block() mm: zswap: fix double invalidate with exclusive loads mm: remove unnecessary pagevec includes mm: remove references to pagevec mm: rename invalidate_mapping_pagevec to mapping_try_invalidate mm: remove struct pagevec net: convert sunrpc from pagevec to folio_batch i915: convert i915_gpu_error to use a folio_batch pagevec: rename fbatch_count() mm: remove check_move_unevictable_pages() drm: convert drm_gem_put_pages() to use a folio_batch i915: convert shmem_sg_free_table() to use a folio_batch scatterlist: add sg_set_folio() ...
2 parents 6aeadf7 + acc72d5 commit 6e17c6d

File tree

334 files changed

+8341
-6905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+8341
-6905
lines changed

Documentation/admin-guide/cgroup-v1/memory.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Lock order is as follows::
297297

298298
Page lock (PG_locked bit of page->flags)
299299
mm->page_table_lock or split pte_lock
300-
lock_page_memcg (memcg->move_lock)
300+
folio_memcg_lock (memcg->move_lock)
301301
mapping->i_pages lock
302302
lruvec->lru_lock.
303303

Documentation/admin-guide/cgroup-v2.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,13 @@ PAGE_SIZE multiple when read back.
15801580

15811581
Healthy workloads are not expected to reach this limit.
15821582

1583+
memory.swap.peak
1584+
A read-only single value file which exists on non-root
1585+
cgroups.
1586+
1587+
The max swap usage recorded for the cgroup and its
1588+
descendants since the creation of the cgroup.
1589+
15831590
memory.swap.max
15841591
A read-write single value file which exists on non-root
15851592
cgroups. The default is "max".

Documentation/admin-guide/mm/damon/start.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ set size has chronologically changed.::
119119
Data Access Pattern Aware Memory Management
120120
===========================================
121121

122-
Below three commands make every memory region of size >=4K that doesn't
123-
accessed for >=60 seconds in your workload to be swapped out. ::
122+
Below command makes every memory region of size >=4K that has not accessed for
123+
>=60 seconds in your workload to be swapped out. ::
124124

125-
$ echo "#min-size max-size min-acc max-acc min-age max-age action" > test_scheme
126-
$ echo "4K max 0 0 60s max pageout" >> test_scheme
127-
$ damo schemes -c test_scheme <pid of your workload>
125+
$ sudo damo schemes --damos_access_rate 0 0 --damos_sz_region 4K max \
126+
--damos_age 60s max --damos_action pageout \
127+
<pid of your workload>

Documentation/admin-guide/mm/damon/usage.rst

Lines changed: 62 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,16 @@ DAMON provides below interfaces for different users.
1010
`This <https://github.com/awslabs/damo>`_ is for privileged people such as
1111
system administrators who want a just-working human-friendly interface.
1212
Using this, users can use the DAMON’s major features in a human-friendly way.
13-
It may not be highly tuned for special cases, though. It supports both
14-
virtual and physical address spaces monitoring. For more detail, please
15-
refer to its `usage document
13+
It may not be highly tuned for special cases, though. For more detail,
14+
please refer to its `usage document
1615
<https://github.com/awslabs/damo/blob/next/USAGE.md>`_.
1716
- *sysfs interface.*
1817
:ref:`This <sysfs_interface>` is for privileged user space programmers who
1918
want more optimized use of DAMON. Using this, users can use DAMON’s major
2019
features by reading from and writing to special sysfs files. Therefore,
2120
you can write and use your personalized DAMON sysfs wrapper programs that
2221
reads/writes the sysfs files instead of you. The `DAMON user space tool
23-
<https://github.com/awslabs/damo>`_ is one example of such programs. It
24-
supports both virtual and physical address spaces monitoring. Note that this
25-
interface provides only simple :ref:`statistics <damos_stats>` for the
26-
monitoring results. For detailed monitoring results, DAMON provides a
27-
:ref:`tracepoint <tracepoint>`.
22+
<https://github.com/awslabs/damo>`_ is one example of such programs.
2823
- *debugfs interface. (DEPRECATED!)*
2924
:ref:`This <debugfs_interface>` is almost identical to :ref:`sysfs interface
3025
<sysfs_interface>`. This is deprecated, so users should move to the
@@ -139,7 +134,7 @@ scheme of the kdamond. Writing ``clear_schemes_tried_regions`` to ``state``
139134
file clears the DAMON-based operating scheme action tried regions directory for
140135
each DAMON-based operation scheme of the kdamond. For details of the
141136
DAMON-based operation scheme action tried regions directory, please refer to
142-
:ref:tried_regions section <sysfs_schemes_tried_regions>`.
137+
:ref:`tried_regions section <sysfs_schemes_tried_regions>`.
143138

144139
If the state is ``on``, reading ``pid`` shows the pid of the kdamond thread.
145140

@@ -259,12 +254,9 @@ be equal or smaller than ``start`` of directory ``N+1``.
259254
contexts/<N>/schemes/
260255
---------------------
261256

262-
For usual DAMON-based data access aware memory management optimizations, users
263-
would normally want the system to apply a memory management action to a memory
264-
region of a specific access pattern. DAMON receives such formalized operation
265-
schemes from the user and applies those to the target memory regions. Users
266-
can get and set the schemes by reading from and writing to files under this
267-
directory.
257+
The directory for DAMON-based Operation Schemes (:ref:`DAMOS
258+
<damon_design_damos>`). Users can get and set the schemes by reading from and
259+
writing to files under this directory.
268260

269261
In the beginning, this directory has only one file, ``nr_schemes``. Writing a
270262
number (``N``) to the file creates the number of child directories named ``0``
@@ -277,12 +269,12 @@ In each scheme directory, five directories (``access_pattern``, ``quotas``,
277269
``watermarks``, ``filters``, ``stats``, and ``tried_regions``) and one file
278270
(``action``) exist.
279271

280-
The ``action`` file is for setting and getting what action you want to apply to
281-
memory regions having specific access pattern of the interest. The keywords
282-
that can be written to and read from the file and their meaning are as below.
272+
The ``action`` file is for setting and getting the scheme's :ref:`action
273+
<damon_design_damos_action>`. The keywords that can be written to and read
274+
from the file and their meaning are as below.
283275

284276
Note that support of each action depends on the running DAMON operations set
285-
`implementation <sysfs_contexts>`.
277+
:ref:`implementation <sysfs_contexts>`.
286278

287279
- ``willneed``: Call ``madvise()`` for the region with ``MADV_WILLNEED``.
288280
Supported by ``vaddr`` and ``fvaddr`` operations set.
@@ -304,56 +296,48 @@ Note that support of each action depends on the running DAMON operations set
304296
schemes/<N>/access_pattern/
305297
---------------------------
306298

307-
The target access pattern of each DAMON-based operation scheme is constructed
308-
with three ranges including the size of the region in bytes, number of
309-
monitored accesses per aggregate interval, and number of aggregated intervals
310-
for the age of the region.
299+
The directory for the target access :ref:`pattern
300+
<damon_design_damos_access_pattern>` of the given DAMON-based operation scheme.
311301

312302
Under the ``access_pattern`` directory, three directories (``sz``,
313303
``nr_accesses``, and ``age``) each having two files (``min`` and ``max``)
314304
exist. You can set and get the access pattern for the given scheme by writing
315305
to and reading from the ``min`` and ``max`` files under ``sz``,
316-
``nr_accesses``, and ``age`` directories, respectively.
306+
``nr_accesses``, and ``age`` directories, respectively. Note that the ``min``
307+
and the ``max`` form a closed interval.
317308

318309
schemes/<N>/quotas/
319310
-------------------
320311

321-
Optimal ``target access pattern`` for each ``action`` is workload dependent, so
322-
not easy to find. Worse yet, setting a scheme of some action too aggressive
323-
can cause severe overhead. To avoid such overhead, users can limit time and
324-
size quota for each scheme. In detail, users can ask DAMON to try to use only
325-
up to specific time (``time quota``) for applying the action, and to apply the
326-
action to only up to specific amount (``size quota``) of memory regions having
327-
the target access pattern within a given time interval (``reset interval``).
328-
329-
When the quota limit is expected to be exceeded, DAMON prioritizes found memory
330-
regions of the ``target access pattern`` based on their size, access frequency,
331-
and age. For personalized prioritization, users can set the weights for the
332-
three properties.
312+
The directory for the :ref:`quotas <damon_design_damos_quotas>` of the given
313+
DAMON-based operation scheme.
333314

334315
Under ``quotas`` directory, three files (``ms``, ``bytes``,
335316
``reset_interval_ms``) and one directory (``weights``) having three files
336317
(``sz_permil``, ``nr_accesses_permil``, and ``age_permil``) in it exist.
337318

338319
You can set the ``time quota`` in milliseconds, ``size quota`` in bytes, and
339320
``reset interval`` in milliseconds by writing the values to the three files,
340-
respectively. You can also set the prioritization weights for size, access
341-
frequency, and age in per-thousand unit by writing the values to the three
342-
files under the ``weights`` directory.
321+
respectively. Then, DAMON tries to use only up to ``time quota`` milliseconds
322+
for applying the ``action`` to memory regions of the ``access_pattern``, and to
323+
apply the action to only up to ``bytes`` bytes of memory regions within the
324+
``reset_interval_ms``. Setting both ``ms`` and ``bytes`` zero disables the
325+
quota limits.
326+
327+
You can also set the :ref:`prioritization weights
328+
<damon_design_damos_quotas_prioritization>` for size, access frequency, and age
329+
in per-thousand unit by writing the values to the three files under the
330+
``weights`` directory.
343331

344332
schemes/<N>/watermarks/
345333
-----------------------
346334

347-
To allow easy activation and deactivation of each scheme based on system
348-
status, DAMON provides a feature called watermarks. The feature receives five
349-
values called ``metric``, ``interval``, ``high``, ``mid``, and ``low``. The
350-
``metric`` is the system metric such as free memory ratio that can be measured.
351-
If the metric value of the system is higher than the value in ``high`` or lower
352-
than ``low`` at the memoent, the scheme is deactivated. If the value is lower
353-
than ``mid``, the scheme is activated.
335+
The directory for the :ref:`watermarks <damon_design_damos_watermarks>` of the
336+
given DAMON-based operation scheme.
354337

355338
Under the watermarks directory, five files (``metric``, ``interval_us``,
356-
``high``, ``mid``, and ``low``) for setting each value exist. You can set and
339+
``high``, ``mid``, and ``low``) for setting the metric, the time interval
340+
between check of the metric, and the three watermarks exist. You can set and
357341
get the five values by writing to the files, respectively.
358342

359343
Keywords and meanings of those that can be written to the ``metric`` file are
@@ -367,12 +351,8 @@ The ``interval`` should written in microseconds unit.
367351
schemes/<N>/filters/
368352
--------------------
369353

370-
Users could know something more than the kernel for specific types of memory.
371-
In the case, users could do their own management for the memory and hence
372-
doesn't want DAMOS bothers that. Users could limit DAMOS by setting the access
373-
pattern of the scheme and/or the monitoring regions for the purpose, but that
374-
can be inefficient in some cases. In such cases, users could set non-access
375-
pattern driven filters using files in this directory.
354+
The directory for the :ref:`filters <damon_design_damos_filters>` of the given
355+
DAMON-based operation scheme.
376356

377357
In the beginning, this directory has only one file, ``nr_filters``. Writing a
378358
number (``N``) to the file creates the number of child directories named ``0``
@@ -432,13 +412,17 @@ starting from ``0`` under this directory. Each directory contains files
432412
exposing detailed information about each of the memory region that the
433413
corresponding scheme's ``action`` has tried to be applied under this directory,
434414
during next :ref:`aggregation interval <sysfs_monitoring_attrs>`. The
435-
information includes address range, ``nr_accesses``, , and ``age`` of the
436-
region.
415+
information includes address range, ``nr_accesses``, and ``age`` of the region.
437416

438417
The directories will be removed when another special keyword,
439418
``clear_schemes_tried_regions``, is written to the relevant
440419
``kdamonds/<N>/state`` file.
441420

421+
The expected usage of this directory is investigations of schemes' behaviors,
422+
and query-like efficient data access monitoring results retrievals. For the
423+
latter use case, in particular, users can set the ``action`` as ``stat`` and
424+
set the ``access pattern`` as their interested pattern that they want to query.
425+
442426
tried_regions/<N>/
443427
------------------
444428

@@ -600,15 +584,10 @@ update.
600584
Schemes
601585
-------
602586

603-
For usual DAMON-based data access aware memory management optimizations, users
604-
would simply want the system to apply a memory management action to a memory
605-
region of a specific access pattern. DAMON receives such formalized operation
606-
schemes from the user and applies those to the target processes.
607-
608-
Users can get and set the schemes by reading from and writing to ``schemes``
609-
debugfs file. Reading the file also shows the statistics of each scheme. To
610-
the file, each of the schemes should be represented in each line in below
611-
form::
587+
Users can get and set the DAMON-based operation :ref:`schemes
588+
<damon_design_damos>` by reading from and writing to ``schemes`` debugfs file.
589+
Reading the file also shows the statistics of each scheme. To the file, each
590+
of the schemes should be represented in each line in below form::
612591

613592
<target access pattern> <action> <quota> <watermarks>
614593

@@ -617,8 +596,9 @@ You can disable schemes by simply writing an empty string to the file.
617596
Target Access Pattern
618597
~~~~~~~~~~~~~~~~~~~~~
619598

620-
The ``<target access pattern>`` is constructed with three ranges in below
621-
form::
599+
The target access :ref:`pattern <damon_design_damos_access_pattern>` of the
600+
scheme. The ``<target access pattern>`` is constructed with three ranges in
601+
below form::
622602

623603
min-size max-size min-acc max-acc min-age max-age
624604

@@ -631,9 +611,9 @@ closed interval.
631611
Action
632612
~~~~~~
633613

634-
The ``<action>`` is a predefined integer for memory management actions, which
635-
DAMON will apply to the regions having the target access pattern. The
636-
supported numbers and their meanings are as below.
614+
The ``<action>`` is a predefined integer for memory management :ref:`actions
615+
<damon_design_damos_action>`. The supported numbers and their meanings are as
616+
below.
637617

638618
- 0: Call ``madvise()`` for the region with ``MADV_WILLNEED``. Ignored if
639619
``target`` is ``paddr``.
@@ -649,10 +629,8 @@ supported numbers and their meanings are as below.
649629
Quota
650630
~~~~~
651631

652-
Optimal ``target access pattern`` for each ``action`` is workload dependent, so
653-
not easy to find. Worse yet, setting a scheme of some action too aggressive
654-
can cause severe overhead. To avoid such overhead, users can limit time and
655-
size quota for the scheme via the ``<quota>`` in below form::
632+
Users can set the :ref:`quotas <damon_design_damos_quotas>` of the given scheme
633+
via the ``<quota>`` in below form::
656634

657635
<ms> <sz> <reset interval> <priority weights>
658636

@@ -662,19 +640,17 @@ the action to memory regions of the ``target access pattern`` within the
662640
``<sz>`` bytes of memory regions within the ``<reset interval>``. Setting both
663641
``<ms>`` and ``<sz>`` zero disables the quota limits.
664642

665-
When the quota limit is expected to be exceeded, DAMON prioritizes found memory
666-
regions of the ``target access pattern`` based on their size, access frequency,
667-
and age. For personalized prioritization, users can set the weights for the
668-
three properties in ``<priority weights>`` in below form::
643+
For the :ref:`prioritization <damon_design_damos_quotas_prioritization>`, users
644+
can set the weights for the three properties in ``<priority weights>`` in below
645+
form::
669646

670647
<size weight> <access frequency weight> <age weight>
671648

672649
Watermarks
673650
~~~~~~~~~~
674651

675-
Some schemes would need to run based on current value of the system's specific
676-
metrics like free memory ratio. For such cases, users can specify watermarks
677-
for the condition.::
652+
Users can specify :ref:`watermarks <damon_design_damos_watermarks>` of the
653+
given scheme via ``<watermarks>`` in below form::
678654

679655
<metric> <check interval> <high mark> <middle mark> <low mark>
680656

@@ -797,10 +773,12 @@ root directory only.
797773
Tracepoint for Monitoring Results
798774
=================================
799775

800-
DAMON provides the monitoring results via a tracepoint,
801-
``damon:damon_aggregated``. While the monitoring is turned on, you could
802-
record the tracepoint events and show results using tracepoint supporting tools
803-
like ``perf``. For example::
776+
Users can get the monitoring results via the :ref:`tried_regions
777+
<sysfs_schemes_tried_regions>` or a tracepoint, ``damon:damon_aggregated``.
778+
While the tried regions directory is useful for getting a snapshot, the
779+
tracepoint is useful for getting a full record of the results. While the
780+
monitoring is turned on, you could record the tracepoint events and show
781+
results using tracepoint supporting tools like ``perf``. For example::
804782

805783
# echo on > monitor_on
806784
# perf record -e damon:damon_aggregated &

Documentation/dev-tools/kasan.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,12 @@ effectively disables ``panic_on_warn`` for KASAN reports.
107107
Alternatively, independent of ``panic_on_warn``, the ``kasan.fault=`` boot
108108
parameter can be used to control panic and reporting behaviour:
109109

110-
- ``kasan.fault=report`` or ``=panic`` controls whether to only print a KASAN
111-
report or also panic the kernel (default: ``report``). The panic happens even
112-
if ``kasan_multi_shot`` is enabled.
110+
- ``kasan.fault=report``, ``=panic``, or ``=panic_on_write`` controls whether
111+
to only print a KASAN report, panic the kernel, or panic the kernel on
112+
invalid writes only (default: ``report``). The panic happens even if
113+
``kasan_multi_shot`` is enabled. Note that when using asynchronous mode of
114+
Hardware Tag-Based KASAN, ``kasan.fault=panic_on_write`` always panics on
115+
asynchronously checked accesses (including reads).
113116

114117
Software and Hardware Tag-Based KASAN modes (see the section about various
115118
modes below) support altering stack trace collection behavior:

Documentation/dev-tools/kselftest.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Running the selftests (hotplug tests are run in limited mode)
3636

3737
To build the tests::
3838

39+
$ make headers
3940
$ make -C tools/testing/selftests
4041

4142
To run the tests::

0 commit comments

Comments
 (0)