linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jglisse@redhat.com
To: linux-kernel@vger.kernel.org
Cc: "Jérôme Glisse" <jglisse@redhat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, "Tejun Heo" <tj@kernel.org>,
	"Jan Kara" <jack@suse.cz>, "Josef Bacik" <jbacik@fb.com>
Subject: [PATCH 01/14] mm/pxa: page exclusive access add header file for all helpers.
Date: Tue,  6 Oct 2020 21:05:50 -0400	[thread overview]
Message-ID: <20201007010603.3452458-2-jglisse@redhat.com> (raw)
In-Reply-To: <20201007010603.3452458-1-jglisse@redhat.com>

From: Jérôme Glisse <jglisse@redhat.com>

Add include/linux/page-xa.h where all helpers related to Page eXclusive
Acces (PXA) will be added (in following patches).

Also introduce MAPPING_NULL as a temporary define use to simplify the
mass modifications to stop relying on struct page.mapping and instead
pass down mapping pointer from the context (either from inode when in
syscall operating on a file or from vma->vm_file when operating on some
virtual address.

This is temporary define, do not use !

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Josef Bacik <jbacik@fb.com>
---
 include/linux/mm.h      |  5 ++++
 include/linux/page-xa.h | 66 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)
 create mode 100644 include/linux/page-xa.h

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 16b799a0522cd..d165961c58c45 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3130,5 +3130,10 @@ unsigned long wp_shared_mapping_range(struct address_space *mapping,
 
 extern int sysctl_nr_trim_pages;
 
+
+/* Page exclusive access do depend on some helpers define in here. */
+#include <linux/page-xa.h>
+
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_MM_H */
diff --git a/include/linux/page-xa.h b/include/linux/page-xa.h
new file mode 100644
index 0000000000000..8ac9e6dc051e0
--- /dev/null
+++ b/include/linux/page-xa.h
@@ -0,0 +1,66 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Page eXclusive Acess (PXA) is a generic mechanism to allow exclusive access
+ * to a file back or an anonymous page. Exclusive access means that no one can
+ * write to page except the owner of the protection (but the page can still be
+ * read). The exclusive access can be _broken_ at anytime and this can not be
+ * block (so anyone using that feature must be ready to give away the exclusive
+ * access at _any_ time and must do so in a timely fashion).
+ *
+ * Using PXA allows to implement few different features:
+ *  - KSM (Kernel Shared Memory) where page with same content are deduplicated
+ *    using a unique page and all mapping are updated to read only. This allow
+ *    to save memory for workload with a lot of pages in different process that
+ *    end up with same content (multiple VM for instance).
+ *
+ *  - NUMA duplication (sort of the opposite of KSM) here a page is duplicated
+ *    into multiple read only copy with each copy using physical memory local a
+ *    NUMA node (or a device). This allow to improve performance by minimizing
+ *    cross node memory transaction and also help minimizing bus traffic. It
+ *    does however use more memory, so what you gain in performance you loose
+ *    in available resources.
+ *
+ *  - Exclusive write access to a page, for instance you can use regular write
+ *    instruction and still get atomic behavior (as you are the only being able
+ *    to write you the garantee that no one can race with you).
+ *
+ * And any other use cases you can think of ...
+ *
+ * See Documentation/vm/page-xa.rst for further informations.
+ *
+ * Authors:
+ *  Jérôme Glisse
+ */
+#ifndef LINUX_PAGE_XA_H
+#define LINUX_PAGE_XA_H
+
+#include <linux/page-flags.h>
+#include <linux/mm_types.h>
+
+
+/*
+ * MAPPING_NULL this is temporary define use to simplify the mass modificaitons
+ * to stop relying on struct page.mapping and instead pass down mapping pointer
+ * from the context (either from inode when in syscall operating on a file or
+ * from vma->vm_file when operating on some virtual address range).
+ *
+ * DO NOT USE ! THIS IS ONLY FOR SEMANTIC PATCHES SIMPLIFICATION !
+ */
+#define MAPPING_NULL NULL
+
+
+/**
+ * PageXA() - is page under exclusive acces ?
+ *
+ * This function checks if a page is under exclusive access.
+ *
+ * @page: Pointer to page to be queried.
+ * @Return: True, if it is under exclusive access, false otherwise.
+ */
+static inline bool PageXA(struct page *page)
+{
+	return false;
+}
+
+
+#endif /* LINUX_PAGE_XA_H */
-- 
2.26.2


  reply	other threads:[~2020-10-07  1:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07  1:05 [PATCH 00/14] Small step toward KSM for file back page jglisse
2020-10-07  1:05 ` jglisse [this message]
2020-10-07  1:05 ` [PATCH 02/14] fs: define filler_t as a function pointer type jglisse
2020-10-07  1:05 ` [PATCH 03/14] fs: directly use a_ops->freepage() instead of a local copy of it jglisse
2020-10-07  1:05 ` [PATCH 04/14] mm: add struct address_space to readpage() callback jglisse
2020-10-07  1:05 ` [PATCH 05/14] mm: add struct address_space to writepage() callback jglisse
2020-10-07  1:05 ` [PATCH 06/14] mm: add struct address_space to set_page_dirty() callback jglisse
2020-10-07  1:05 ` [PATCH 07/14] mm: add struct address_space to invalidatepage() callback jglisse
2020-10-07  1:05 ` [PATCH 08/14] mm: add struct address_space to releasepage() callback jglisse
2020-10-07  1:05 ` [PATCH 09/14] mm: add struct address_space to freepage() callback jglisse
2020-10-07  1:05 ` [PATCH 10/14] mm: add struct address_space to putback_page() callback jglisse
2020-10-07  1:06 ` [PATCH 11/14] mm: add struct address_space to launder_page() callback jglisse
2020-10-07  1:06 ` [PATCH 12/14] mm: add struct address_space to is_partially_uptodate() callback jglisse
2020-10-07  1:06 ` [PATCH 13/14] mm: add struct address_space to isolate_page() callback jglisse
2020-10-07  1:06 ` [PATCH 14/14] mm: add struct address_space to is_dirty_writeback() callback jglisse
2020-10-07  3:20 ` [PATCH 00/14] Small step toward KSM for file back page Matthew Wilcox
2020-10-07 14:48   ` Jerome Glisse
2020-10-07 17:05     ` Matthew Wilcox
2020-10-07 17:54       ` Jerome Glisse
2020-10-07 18:33         ` Matthew Wilcox
2020-10-07 21:45           ` Jerome Glisse
2020-10-07 22:09         ` Matthew Wilcox
2020-10-08 15:30           ` Jerome Glisse
2020-10-08 15:43             ` Matthew Wilcox
2020-10-08 18:48               ` Jerome Glisse

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=20201007010603.3452458-2-jglisse@redhat.com \
    --to=jglisse@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=jbacik@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).