All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
	Matthew Wilcox <mawilcox@microsoft.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-doc@vger.kernel.org, linux-mm@kvack.org,
	Dave Hansen <dave.hansen@intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>,
	linux-ext4@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	linux-nvdimm@lists.01.org
Subject: [PATCH v2 0/3] DAX common 4k zero page
Date: Wed, 14 Jun 2017 11:22:08 -0600	[thread overview]
Message-ID: <20170614172211.19820-1-ross.zwisler@linux.intel.com> (raw)

When servicing mmap() reads from file holes the current DAX code allocates
a page cache page of all zeroes and places the struct page pointer in the
mapping->page_tree radix tree.  This has two major drawbacks:

1) It consumes memory unnecessarily.  For every 4k page that is read via a
DAX mmap() over a hole, we allocate a new page cache page.  This means that
if you read 1GiB worth of pages, you end up using 1GiB of zeroed memory.

2) The fact that we had to check for both DAX exceptional entries and for
page cache pages in the radix tree made the DAX code more complex.

This series solves these issues by following the lead of the DAX PMD code
and using a common 4k zero page instead.  This reduces memory usage for
some workloads, and it also simplifies the code in fs/dax.c, removing about
100 lines of code.

My hope is to have this reviewed and merged in time for v4.13 via the MM
tree, so if you could spare some review cycles I'd be grateful.

---
Changes since v1:
 - Leave vm_insert_mixed() instact with previous functionality and add
   vm_insert_mixed_mkwrite() as a peer so it is more readable/greppable.
   (Dan)

Ross Zwisler (3):
  mm: add vm_insert_mixed_mkwrite()
  dax: relocate dax_load_hole()
  dax: use common 4k zero page for dax mmap reads

 Documentation/filesystems/dax.txt |   5 +-
 fs/dax.c                          | 265 ++++++++++++--------------------------
 fs/ext2/file.c                    |  25 +---
 fs/ext4/file.c                    |  32 +----
 fs/xfs/xfs_file.c                 |   2 +-
 include/linux/dax.h               |  13 +-
 include/linux/mm.h                |   2 +
 include/trace/events/fs_dax.h     |   2 -
 mm/memory.c                       |  49 ++++++-
 9 files changed, 141 insertions(+), 254 deletions(-)

-- 
2.9.4

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Christoph Hellwig <hch@lst.de>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Ingo Molnar <mingo@redhat.com>, Jan Kara <jack@suse.cz>,
	Jonathan Corbet <corbet@lwn.net>,
	Matthew Wilcox <mawilcox@microsoft.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-nvdimm@lists.01.org, linux-xfs@vger.kernel.org
Subject: [PATCH v2 0/3] DAX common 4k zero page
Date: Wed, 14 Jun 2017 11:22:08 -0600	[thread overview]
Message-ID: <20170614172211.19820-1-ross.zwisler@linux.intel.com> (raw)

When servicing mmap() reads from file holes the current DAX code allocates
a page cache page of all zeroes and places the struct page pointer in the
mapping->page_tree radix tree.  This has two major drawbacks:

1) It consumes memory unnecessarily.  For every 4k page that is read via a
DAX mmap() over a hole, we allocate a new page cache page.  This means that
if you read 1GiB worth of pages, you end up using 1GiB of zeroed memory.

2) The fact that we had to check for both DAX exceptional entries and for
page cache pages in the radix tree made the DAX code more complex.

This series solves these issues by following the lead of the DAX PMD code
and using a common 4k zero page instead.  This reduces memory usage for
some workloads, and it also simplifies the code in fs/dax.c, removing about
100 lines of code.

My hope is to have this reviewed and merged in time for v4.13 via the MM
tree, so if you could spare some review cycles I'd be grateful.

---
Changes since v1:
 - Leave vm_insert_mixed() instact with previous functionality and add
   vm_insert_mixed_mkwrite() as a peer so it is more readable/greppable.
   (Dan)

Ross Zwisler (3):
  mm: add vm_insert_mixed_mkwrite()
  dax: relocate dax_load_hole()
  dax: use common 4k zero page for dax mmap reads

 Documentation/filesystems/dax.txt |   5 +-
 fs/dax.c                          | 265 ++++++++++++--------------------------
 fs/ext2/file.c                    |  25 +---
 fs/ext4/file.c                    |  32 +----
 fs/xfs/xfs_file.c                 |   2 +-
 include/linux/dax.h               |  13 +-
 include/linux/mm.h                |   2 +
 include/trace/events/fs_dax.h     |   2 -
 mm/memory.c                       |  49 ++++++-
 9 files changed, 141 insertions(+), 254 deletions(-)

-- 
2.9.4

WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Christoph Hellwig <hch@lst.de>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Ingo Molnar <mingo@redhat.com>, Jan Kara <jack@suse.cz>,
	Jonathan Corbet <corbet@lwn.net>,
	Matthew Wilcox <mawilcox@microsoft.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-nvdimm@lists.01.org, linux-xfs@vger.kernel.org
Subject: [PATCH v2 0/3] DAX common 4k zero page
Date: Wed, 14 Jun 2017 11:22:08 -0600	[thread overview]
Message-ID: <20170614172211.19820-1-ross.zwisler@linux.intel.com> (raw)

When servicing mmap() reads from file holes the current DAX code allocates
a page cache page of all zeroes and places the struct page pointer in the
mapping->page_tree radix tree.  This has two major drawbacks:

1) It consumes memory unnecessarily.  For every 4k page that is read via a
DAX mmap() over a hole, we allocate a new page cache page.  This means that
if you read 1GiB worth of pages, you end up using 1GiB of zeroed memory.

2) The fact that we had to check for both DAX exceptional entries and for
page cache pages in the radix tree made the DAX code more complex.

This series solves these issues by following the lead of the DAX PMD code
and using a common 4k zero page instead.  This reduces memory usage for
some workloads, and it also simplifies the code in fs/dax.c, removing about
100 lines of code.

My hope is to have this reviewed and merged in time for v4.13 via the MM
tree, so if you could spare some review cycles I'd be grateful.

---
Changes since v1:
 - Leave vm_insert_mixed() instact with previous functionality and add
   vm_insert_mixed_mkwrite() as a peer so it is more readable/greppable.
   (Dan)

Ross Zwisler (3):
  mm: add vm_insert_mixed_mkwrite()
  dax: relocate dax_load_hole()
  dax: use common 4k zero page for dax mmap reads

 Documentation/filesystems/dax.txt |   5 +-
 fs/dax.c                          | 265 ++++++++++++--------------------------
 fs/ext2/file.c                    |  25 +---
 fs/ext4/file.c                    |  32 +----
 fs/xfs/xfs_file.c                 |   2 +-
 include/linux/dax.h               |  13 +-
 include/linux/mm.h                |   2 +
 include/trace/events/fs_dax.h     |   2 -
 mm/memory.c                       |  49 ++++++-
 9 files changed, 141 insertions(+), 254 deletions(-)

-- 
2.9.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2017-06-14 17:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 17:22 Ross Zwisler [this message]
2017-06-14 17:22 ` [PATCH v2 0/3] DAX common 4k zero page Ross Zwisler
2017-06-14 17:22 ` Ross Zwisler
2017-06-14 17:22 ` [PATCH v2 1/3] mm: add vm_insert_mixed_mkwrite() Ross Zwisler
2017-06-14 17:22   ` Ross Zwisler
2017-06-14 17:22   ` Ross Zwisler
2017-06-15 14:42   ` Jan Kara
2017-06-15 14:42     ` Jan Kara
2017-06-15 14:42     ` Jan Kara
2017-06-16 19:44     ` Ross Zwisler
2017-06-16 19:44       ` Ross Zwisler
2017-06-16 19:44       ` Ross Zwisler
2017-06-17  4:09     ` Ross Zwisler
2017-06-17  4:09       ` Ross Zwisler
2017-06-17  4:09       ` Ross Zwisler
2017-06-23 15:25       ` Jan Kara
2017-06-23 15:25         ` Jan Kara
2017-06-23 15:25         ` Jan Kara
2017-06-14 17:22 ` [PATCH v2 2/3] dax: relocate dax_load_hole() Ross Zwisler
2017-06-14 17:22   ` Ross Zwisler
2017-06-14 17:22   ` Ross Zwisler
2017-06-14 17:22   ` Ross Zwisler
2017-06-14 17:22 ` [PATCH v2 3/3] dax: use common 4k zero page for dax mmap reads Ross Zwisler
2017-06-14 17:22   ` Ross Zwisler
2017-06-14 17:22   ` Ross Zwisler
2017-06-14 17:22   ` Ross Zwisler
2017-06-15 14:58   ` Jan Kara
2017-06-15 14:58     ` Jan Kara
2017-06-15 14:58     ` Jan Kara
2017-06-15 14:58     ` Jan Kara
2017-06-16 19:45     ` Ross Zwisler
2017-06-16 19:45       ` Ross Zwisler
2017-06-16 19:45       ` Ross Zwisler
2017-06-16 19:45       ` Ross Zwisler

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=20170614172211.19820-1-ross.zwisler@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=darrick.wong@oracle.com \
    --cc=dave.hansen@intel.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mawilcox@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tytso@mit.edu \
    --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 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.