From: Boaz Harrosh <boazh@netapp.com>
To: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Cc: Ric Wheeler <rwheeler@redhat.com>,
Miklos Szeredi <mszeredi@redhat.com>,
Steve French <smfrench@gmail.com>,
Steven Whitehouse <swhiteho@redhat.com>,
Jefff moyer <jmoyer@redhat.com>, Sage Weil <sweil@redhat.com>,
Jan Kara <jack@suse.cz>, Amir Goldstein <amir73il@gmail.com>,
Andy Rudof <andy.rudoff@intel.com>,
Anna Schumaker <Anna.Schumaker@netapp.com>,
Amit Golander <Amit.Golander@netapp.com>,
Sagi Manole <sagim@netapp.com>,
Shachar Sharon <Shachar.Sharon@netapp.com>
Subject: [RFC 1/7] mm: Add new vma flag VM_LOCAL_CPU
Date: Tue, 13 Mar 2018 19:15:46 +0200 [thread overview]
Message-ID: <443fea57-f165-6bed-8c8a-0a32f72b9cd2@netapp.com> (raw)
In-Reply-To: <d5db55b6-e488-986a-81b1-a3514e8eba81@netapp.com>
On a call to mmap an mmap provider (like an FS) can put
this flag on vma->vm_flags.
This tells the Kernel that the vma will be used from a single
core only and therefore invalidation of PTE(s) need not a
wide CPU scheduling
The motivation of this flag is the ZUFS project where we want
to optimally map user-application buffers into a user-mode-server
execute the operation and efficiently unmap.
In this project we utilize a per-core server thread so everything
is kept local. If we use the regular zap_ptes() API All CPU's
are scheduled for the unmap, though in our case we know that we
have only used a single core. The regular zap_ptes adds a very big
latency on every operations and mostly kills the concurrency of the
over all system. Because it imposes a serialization between all cores
Some preliminary measurements on a 40 core machines:
unpatched patched
Threads Op/s Lat [us] Op/s Lat [us]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 185391 4.9 200799 4.6
2 197993 9.6 314321 5.9
4 310597 12.1 565574 6.6
8 546702 13.8 1113138 6.6
12 641728 17.2 1598451 6.8
18 744750 22.2 1648689 7.8
24 790805 28.3 1702285 8
36 849763 38.9 1783346 13.4
48 792000 44.6 1741873 17.4
[FIXME]
We need to actually impose this policy. On very first
pte_insert we should sample the used CPU_ID and on all
susequent pte_inserts we need to make sure it is the
same CPU_ID used.
NOTE: That this vma is never used during a page_fault. It is
always used in a synchronous way from an affinity set thread
to a single core.
Signed-off-by: Boaz Harrosh <boazh@netapp.com>
---
fs/proc/task_mmu.c | 3 +++
include/linux/mm.h | 3 +++
mm/memory.c | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 339e4c1..20786ba 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -681,6 +681,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
[ilog2(VM_PKEY_BIT2)] = "",
[ilog2(VM_PKEY_BIT3)] = "",
#endif
+#ifdef CONFIG_ARCH_USES_HIGH_VMA_FLAGS
+ [ilog2(VM_LOCAL_CPU)] = "lc",
+#endif
};
size_t i;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ea818ff..02bb8b5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -226,6 +226,9 @@ extern unsigned int kobjsize(const void *objp);
#define VM_HIGH_ARCH_2 BIT(VM_HIGH_ARCH_BIT_2)
#define VM_HIGH_ARCH_3 BIT(VM_HIGH_ARCH_BIT_3)
#define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4)
+#define VM_LOCAL_CPU BIT(37) /* FIXME: Needs to move from here */
+#else /* ! CONFIG_ARCH_USES_HIGH_VMA_FLAGS */
+#define VM_LOCAL_CPU 0 /* FIXME: Needs to move from here */
#endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */
#if defined(CONFIG_X86)
diff --git a/mm/memory.c b/mm/memory.c
index 7930046..7620ced 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1804,7 +1804,7 @@ static int insert_pfn(struct vm_area_struct *vma, unsigned long addr,
goto out_unlock;
entry = *pte;
goto out_mkwrite;
- } else
+ } else if (!(vma->vm_flags & VM_LOCAL_CPU))
goto out_unlock;
}
--
2.5.5
next prev parent reply other threads:[~2018-03-13 17:25 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 17:14 [RFC 0/7] first draft of ZUFS - the Kernel part Boaz Harrosh
2018-03-13 17:15 ` Boaz Harrosh [this message]
2018-03-13 18:56 ` [RFC 1/7] mm: Add new vma flag VM_LOCAL_CPU Matthew Wilcox
2018-03-14 8:20 ` Miklos Szeredi
2018-03-14 11:17 ` Matthew Wilcox
2018-03-14 11:31 ` Miklos Szeredi
2018-03-14 11:45 ` Matthew Wilcox
2018-03-14 14:49 ` Miklos Szeredi
2018-03-14 14:57 ` Matthew Wilcox
2018-03-14 15:39 ` Miklos Szeredi
[not found] ` <CAON-v2ygEDCn90C9t-zadjsd5GRgj0ECqntQSDDtO_Zjk=KoVw@mail.gmail.com>
2018-03-14 16:48 ` Matthew Wilcox
2018-03-14 21:41 ` Boaz Harrosh
2018-03-15 8:47 ` Miklos Szeredi
2018-03-15 15:27 ` Boaz Harrosh
2018-03-15 15:34 ` Matthew Wilcox
2018-03-15 15:58 ` Boaz Harrosh
2018-03-15 16:10 ` Miklos Szeredi
2018-03-15 16:30 ` Boaz Harrosh
2018-03-15 20:42 ` Miklos Szeredi
2018-04-25 12:21 ` Boaz Harrosh
2018-05-07 10:46 ` Miklos Szeredi
2018-03-13 17:17 ` [RFC 2/7] fs: Add the ZUF filesystem to the build + License Boaz Harrosh
2018-03-13 20:16 ` Andreas Dilger
2018-03-14 17:21 ` Boaz Harrosh
2018-03-15 4:21 ` Andreas Dilger
2018-03-15 13:58 ` Boaz Harrosh
2018-03-13 17:18 ` [RFC 3/7] zuf: Preliminary Documentation Boaz Harrosh
2018-03-13 20:32 ` Randy Dunlap
2018-03-14 18:01 ` Boaz Harrosh
2018-03-14 19:16 ` Randy Dunlap
2018-03-13 17:22 ` [RFC 4/7] zuf: zuf-rootfs && zuf-core Boaz Harrosh
2018-03-13 17:36 ` Boaz Harrosh
2018-03-14 12:56 ` Nikolay Borisov
2018-03-14 18:34 ` Boaz Harrosh
2018-03-13 17:25 ` [RFC 5/7] zus: Devices && mounting Boaz Harrosh
2018-03-13 17:38 ` Boaz Harrosh
2018-03-13 17:28 ` [RFC 6/7] zuf: Filesystem operations Boaz Harrosh
2018-03-13 17:39 ` Boaz Harrosh
2018-03-13 17:32 ` [RFC 7/7] zuf: Write/Read && mmap implementation Boaz Harrosh
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=443fea57-f165-6bed-8c8a-0a32f72b9cd2@netapp.com \
--to=boazh@netapp.com \
--cc=Amit.Golander@netapp.com \
--cc=Anna.Schumaker@netapp.com \
--cc=Shachar.Sharon@netapp.com \
--cc=amir73il@gmail.com \
--cc=andy.rudoff@intel.com \
--cc=jack@suse.cz \
--cc=jmoyer@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mszeredi@redhat.com \
--cc=rwheeler@redhat.com \
--cc=sagim@netapp.com \
--cc=smfrench@gmail.com \
--cc=sweil@redhat.com \
--cc=swhiteho@redhat.com \
/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).