All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/16] Sanitize usage of ->flags and ->mapping for tail pages
@ 2015-03-19 17:08 ` Kirill A. Shutemov
  0 siblings, 0 replies; 117+ messages in thread
From: Kirill A. Shutemov @ 2015-03-19 17:08 UTC (permalink / raw)
  To: Andrew Morton, Andrea Arcangeli, Hugh Dickins
  Cc: Dave Hansen, Mel Gorman, Rik van Riel, Vlastimil Babka,
	Christoph Lameter, Naoya Horiguchi, Steve Capper,
	Aneesh Kumar K.V, Johannes Weiner, Michal Hocko, Jerome Marchand,
	linux-kernel, linux-mm, Kirill A. Shutemov

Currently we take naive approach to page flags on compound -- we set the
flag on the page without consideration if the flag makes sense for tail
page or for compound page in general. This patchset try to sort this out
by defining per-flag policy on what need to be done if page-flag helper
operate on compound page.

The last patch in patchset also sanitize usege of page->mapping for tail
pages. We don't define meaning of page->mapping for tail pages. Currently
it's always NULL, which can be inconsistent with head page and potentially
lead to problems.

For now I catched one case of illigal usage of page flags or ->mapping:
sound subsystem allocates pages with __GFP_COMP and maps them with PTEs.
It leads to setting dirty bit on tail pages and access to tail_page's
->mapping. I don't see any bad behaviour caused by this, but worth fixing
anyway.

This patchset makes more sense if you take my THP refcounting into
account: we will see more compound pages mapped with PTEs and we need to
define behaviour of flags on compound pages to avoid bugs.

Kirill A. Shutemov (16):
  mm: consolidate all page-flags helpers in <linux/page-flags.h>
  page-flags: trivial cleanup for PageTrans* helpers
  page-flags: introduce page flags policies wrt compound pages
  page-flags: define PG_locked behavior on compound pages
  page-flags: define behavior of FS/IO-related flags on compound pages
  page-flags: define behavior of LRU-related flags on compound pages
  page-flags: define behavior SL*B-related flags on compound pages
  page-flags: define behavior of Xen-related flags on compound pages
  page-flags: define PG_reserved behavior on compound pages
  page-flags: define PG_swapbacked behavior on compound pages
  page-flags: define PG_swapcache behavior on compound pages
  page-flags: define PG_mlocked behavior on compound pages
  page-flags: define PG_uncached behavior on compound pages
  page-flags: define PG_uptodate behavior on compound pages
  page-flags: look on head page if the flag is encoded in page->mapping
  mm: sanitize page->mapping for tail pages

 fs/cifs/file.c             |   8 +-
 include/linux/hugetlb.h    |   7 -
 include/linux/ksm.h        |  17 ---
 include/linux/mm.h         | 122 +----------------
 include/linux/page-flags.h | 317 ++++++++++++++++++++++++++++++++++-----------
 include/linux/pagemap.h    |  25 ++--
 include/linux/poison.h     |   4 +
 mm/filemap.c               |  15 ++-
 mm/huge_memory.c           |   2 +-
 mm/ksm.c                   |   2 +-
 mm/memory-failure.c        |   2 +-
 mm/memory.c                |   2 +-
 mm/migrate.c               |   2 +-
 mm/page_alloc.c            |   7 +
 mm/shmem.c                 |   4 +-
 mm/slub.c                  |   2 +
 mm/swap_state.c            |   4 +-
 mm/util.c                  |   5 +-
 mm/vmscan.c                |   4 +-
 mm/zswap.c                 |   4 +-
 20 files changed, 294 insertions(+), 261 deletions(-)

-- 
2.1.4


^ permalink raw reply	[flat|nested] 117+ messages in thread

end of thread, other threads:[~2020-02-03 17:29 UTC | newest]

Thread overview: 117+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 17:08 [PATCH 00/16] Sanitize usage of ->flags and ->mapping for tail pages Kirill A. Shutemov
2015-03-19 17:08 ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 01/16] mm: consolidate all page-flags helpers in <linux/page-flags.h> Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-23  0:10   ` Hugh Dickins
2015-03-23  0:10     ` Hugh Dickins
2015-03-19 17:08 ` [PATCH 02/16] page-flags: trivial cleanup for PageTrans* helpers Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-23  0:12   ` Hugh Dickins
2015-03-23  0:12     ` Hugh Dickins
2015-03-19 17:08 ` [PATCH 03/16] page-flags: introduce page flags policies wrt compound pages Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-20 20:35   ` Andrew Morton
2015-03-20 20:35     ` Andrew Morton
2015-03-20 21:34     ` Kirill A. Shutemov
2015-03-20 21:34       ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 04/16] page-flags: define PG_locked behavior on " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-27 15:11   ` Mateusz Krawczuk
2015-03-27 15:11     ` Mateusz Krawczuk
2015-03-27 15:13   ` Mateusz Krawczuk
2015-03-27 15:13     ` Mateusz Krawczuk
2015-03-27 15:13     ` Mateusz Krawczuk
2015-03-27 16:37     ` Kirill A. Shutemov
2015-03-27 16:37       ` Kirill A. Shutemov
2015-03-27 16:37       ` Kirill A. Shutemov
2015-07-15 20:20   ` Christoph Lameter
2015-07-15 20:20     ` Christoph Lameter
2015-08-06  4:15   ` page-flags behavior on compound pages: a worry Hugh Dickins
2015-08-06  4:15     ` Hugh Dickins
2015-08-06 15:33     ` Kirill A. Shutemov
2015-08-06 15:33       ` Kirill A. Shutemov
2015-08-06 19:24       ` Hugh Dickins
2015-08-06 19:24         ` Hugh Dickins
2015-08-06 20:45         ` Christoph Lameter
2015-08-06 20:45           ` Christoph Lameter
2015-08-07 14:50           ` Kirill A. Shutemov
2015-08-07 14:50             ` Kirill A. Shutemov
2015-08-07 15:28             ` Christoph Lameter
2015-08-07 15:28               ` Christoph Lameter
2015-08-10 11:09               ` Kirill A. Shutemov
2015-08-10 11:09                 ` Kirill A. Shutemov
2015-08-10 13:50                 ` Christoph Lameter
2015-08-10 13:50                   ` Christoph Lameter
2015-08-07 14:49         ` Kirill A. Shutemov
2015-08-07 14:49           ` Kirill A. Shutemov
2015-08-13  5:10           ` Hugh Dickins
2015-08-13  5:10             ` Hugh Dickins
2015-08-12 14:35         ` Kirill A. Shutemov
2015-08-12 14:35           ` Kirill A. Shutemov
2015-08-12 14:47           ` Vlastimil Babka
2015-08-12 14:47             ` Vlastimil Babka
2015-08-12 21:16           ` Andrew Morton
2015-08-12 21:16             ` Andrew Morton
2015-08-12 22:21             ` Kirill A. Shutemov
2015-08-12 22:21               ` Kirill A. Shutemov
2015-08-13  4:12               ` Hugh Dickins
2015-08-13  4:12                 ` Hugh Dickins
2015-03-19 17:08 ` [PATCH 05/16] page-flags: define behavior of FS/IO-related flags on compound pages Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 18:29   ` Dave Hansen
2015-03-19 18:29     ` Dave Hansen
2015-03-19 20:02     ` Kirill A. Shutemov
2015-03-19 20:02       ` Kirill A. Shutemov
2015-03-23  0:02       ` Hugh Dickins
2015-03-23  0:02         ` Hugh Dickins
2015-03-23 12:17         ` Kirill A. Shutemov
2015-03-23 12:17           ` Kirill A. Shutemov
2015-03-24 22:54           ` Hugh Dickins
2015-03-24 22:54             ` Hugh Dickins
2015-03-25 10:23             ` Kirill A. Shutemov
2015-03-25 10:23               ` Kirill A. Shutemov
2015-03-25 18:56               ` Hugh Dickins
2015-03-25 18:56                 ` Hugh Dickins
2015-03-19 17:08 ` [PATCH 06/16] page-flags: define behavior of LRU-related " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 07/16] page-flags: define behavior SL*B-related " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 08/16] page-flags: define behavior of Xen-related " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 09/16] page-flags: define PG_reserved behavior " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2020-01-31 15:24   ` Chris Wilson
2020-02-03 15:18     ` Kirill A. Shutemov
2020-02-03 15:24       ` Chris Wilson
2020-02-03 17:10         ` David Hildenbrand
2020-02-03 17:29       ` Christoph Hellwig
2015-03-19 17:08 ` [PATCH 10/16] page-flags: define PG_swapbacked " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 11/16] page-flags: define PG_swapcache " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 12/16] page-flags: define PG_mlocked " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 13/16] page-flags: define PG_uncached " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 14/16] page-flags: define PG_uptodate " Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 15/16] page-flags: look on head page if the flag is encoded in page->mapping Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-19 17:08 ` [PATCH 16/16] mm: sanitize page->mapping for tail pages Kirill A. Shutemov
2015-03-19 17:08   ` Kirill A. Shutemov
2015-03-23  0:28 ` [PATCH 00/16] Sanitize usage of ->flags and ->mapping " Hugh Dickins
2015-03-23  0:28   ` Hugh Dickins
2015-03-23 10:04   ` Kirill A. Shutemov
2015-03-23 10:04     ` Kirill A. Shutemov
2015-03-24 23:42     ` Hugh Dickins
2015-03-24 23:42       ` Hugh Dickins
2015-03-25 10:55       ` Kirill A. Shutemov
2015-03-25 10:55         ` Kirill A. Shutemov
2015-03-24 17:39 ` Konstantin Khlebnikov
2015-03-24 17:39   ` Konstantin Khlebnikov
2015-03-24 20:04   ` Kirill A. Shutemov
2015-03-24 20:04     ` Kirill A. Shutemov
2015-07-15 20:20 ` Christoph Lameter
2015-07-15 20:20   ` Christoph Lameter
2015-07-15 21:18   ` Kirill A. Shutemov
2015-07-15 21:18     ` Kirill A. Shutemov

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.