From: "Darrick J. Wong" <djwong@kernel.org>
To: Khalid Aziz <khalid.aziz@oracle.com>
Cc: akpm@linux-foundation.org, willy@infradead.org,
aneesh.kumar@linux.ibm.com, arnd@arndb.de, 21cnbao@gmail.com,
corbet@lwn.net, dave.hansen@linux.intel.com, david@redhat.com,
ebiederm@xmission.com, hagen@jauu.net, jack@suse.cz,
keescook@chromium.org, kirill@shutemov.name, kucharsk@gmail.com,
linkinjeon@kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
longpeng2@huawei.com, luto@kernel.org, markhemm@googlemail.com,
pcc@google.com, rppt@kernel.org, sieberf@amazon.com,
sjpark@amazon.de, surenb@google.com, tst@schoebel-theuer.de,
yzaikin@google.com
Subject: Re: [PATCH v2 2/9] mm/mshare: pre-populate msharefs with information file
Date: Thu, 30 Jun 2022 14:37:45 -0700 [thread overview]
Message-ID: <Yr4Xqe22CI/ff0ge@magnolia> (raw)
In-Reply-To: <34e2eabbef5916c784dc16856ce25b3967f9b405.1656531090.git.khalid.aziz@oracle.com>
On Wed, Jun 29, 2022 at 04:53:53PM -0600, Khalid Aziz wrote:
> Users of mshare feature to share page tables need to know the size
> and alignment requirement for shared regions. Pre-populate msharefs
> with a file, mshare_info, that provides this information.
>
> Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
> ---
> mm/mshare.c | 62 +++++++++++++++++++++++++++++++++++++++++------------
> 1 file changed, 48 insertions(+), 14 deletions(-)
>
> diff --git a/mm/mshare.c b/mm/mshare.c
> index c8fab3869bab..3e448e11c742 100644
> --- a/mm/mshare.c
> +++ b/mm/mshare.c
> @@ -25,8 +25,8 @@
> static struct super_block *msharefs_sb;
>
> static const struct file_operations msharefs_file_operations = {
> - .open = simple_open,
> - .llseek = no_llseek,
> + .open = simple_open,
> + .llseek = no_llseek,
I feel like there's a lot of churn between the previous patch and this
one that could have been in the previous patch.
> };
>
> static int
> @@ -42,23 +42,52 @@ msharefs_d_hash(const struct dentry *dentry, struct qstr *qstr)
> return 0;
> }
>
> +static void
> +mshare_evict_inode(struct inode *inode)
> +{
> + clear_inode(inode);
> +}
> +
> static const struct dentry_operations msharefs_d_ops = {
> .d_hash = msharefs_d_hash,
> };
>
> +static ssize_t
> +mshare_info_read(struct file *file, char __user *buf, size_t nbytes,
> + loff_t *ppos)
> +{
> + char s[80];
> +
> + sprintf(s, "%ld", PGDIR_SIZE);
SO what is this "mshare_info" file supposed to reveal? Hugepage size?
I wonder why this isn't exported in struct mshare_info?
> + return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s));
> +}
> +
> +static const struct file_operations mshare_info_ops = {
> + .read = mshare_info_read,
> + .llseek = noop_llseek,
> +};
> +
> +static const struct super_operations mshare_s_ops = {
> + .statfs = simple_statfs,
> + .evict_inode = mshare_evict_inode,
> +};
> +
> static int
> msharefs_fill_super(struct super_block *sb, struct fs_context *fc)
> {
> - static const struct tree_descr empty_descr = {""};
> + static const struct tree_descr mshare_files[] = {
> + [2] = { "mshare_info", &mshare_info_ops, 0444},
> + {""},
> + };
> int err;
>
> - sb->s_d_op = &msharefs_d_ops;
> - err = simple_fill_super(sb, MSHARE_MAGIC, &empty_descr);
> - if (err)
> - return err;
> -
> - msharefs_sb = sb;
> - return 0;
> + err = simple_fill_super(sb, MSHARE_MAGIC, mshare_files);
> + if (!err) {
> + msharefs_sb = sb;
> + sb->s_d_op = &msharefs_d_ops;
> + sb->s_op = &mshare_s_ops;
> + }
> + return err;
> }
>
> static int
> @@ -84,20 +113,25 @@ static struct file_system_type mshare_fs = {
> .kill_sb = kill_litter_super,
> };
>
> -static int
> +static int __init
> mshare_init(void)
> {
> int ret = 0;
>
> ret = sysfs_create_mount_point(fs_kobj, "mshare");
> if (ret)
> - return ret;
> + goto out;
>
> ret = register_filesystem(&mshare_fs);
> - if (ret)
> + if (ret) {
> sysfs_remove_mount_point(fs_kobj, "mshare");
> + goto out;
> + }
> +
> + return 0;
>
> +out:
> return ret;
> }
>
> -fs_initcall(mshare_init);
> +core_initcall(mshare_init);
> --
> 2.32.0
>
next prev parent reply other threads:[~2022-06-30 21:37 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 22:53 [PATCH v2 0/9] Add support for shared PTEs across processes Khalid Aziz
2022-06-29 22:53 ` [PATCH v2 1/9] mm: Add msharefs filesystem Khalid Aziz
2022-06-30 21:53 ` Darrick J. Wong
2022-07-01 16:05 ` Khalid Aziz
2022-06-30 22:57 ` Al Viro
2022-07-01 16:08 ` Khalid Aziz
2022-06-29 22:53 ` [PATCH v2 2/9] mm/mshare: pre-populate msharefs with information file Khalid Aziz
2022-06-30 21:37 ` Darrick J. Wong [this message]
2022-06-30 22:54 ` Khalid Aziz
2022-06-30 23:01 ` Al Viro
2022-07-01 16:11 ` Khalid Aziz
2022-06-29 22:53 ` [PATCH v2 3/9] mm/mshare: make msharefs writable and support directories Khalid Aziz
2022-06-30 21:34 ` Darrick J. Wong
2022-06-30 22:49 ` Khalid Aziz
2022-06-30 23:09 ` Al Viro
2022-07-02 0:22 ` Khalid Aziz
2022-06-29 22:53 ` [PATCH v2 4/9] mm/mshare: Add a read operation for msharefs files Khalid Aziz
2022-06-30 21:27 ` Darrick J. Wong
2022-06-30 22:27 ` Khalid Aziz
2022-06-29 22:53 ` [PATCH v2 5/9] mm/mshare: Add vm flag for shared PTE Khalid Aziz
2022-06-30 14:59 ` Mark Hemment
2022-06-30 15:46 ` Khalid Aziz
2022-06-29 22:53 ` [PATCH v2 6/9] mm/mshare: Add mmap operation Khalid Aziz
2022-06-30 21:44 ` Darrick J. Wong
2022-06-30 23:30 ` Khalid Aziz
2022-06-29 22:53 ` [PATCH v2 7/9] mm/mshare: Add unlink and munmap support Khalid Aziz
2022-06-30 21:50 ` Darrick J. Wong
2022-07-01 15:58 ` Khalid Aziz
2022-06-29 22:53 ` [PATCH v2 8/9] mm/mshare: Add basic page table sharing support Khalid Aziz
2022-07-07 9:13 ` Xin Hao
2022-07-07 15:33 ` Khalid Aziz
2022-06-29 22:54 ` [PATCH v2 9/9] mm/mshare: Enable mshare region mapping across processes Khalid Aziz
2022-06-30 11:57 ` [PATCH v2 0/9] Add support for shared PTEs " Mark Hemment
2022-06-30 15:39 ` Khalid Aziz
2022-07-02 4:24 ` Andrew Morton
2022-07-06 19:26 ` Khalid Aziz
2022-07-08 11:47 ` David Hildenbrand
2022-07-08 19:36 ` Khalid Aziz
2022-07-13 14:00 ` David Hildenbrand
2022-07-13 17:58 ` Mike Kravetz
2022-07-13 18:03 ` David Hildenbrand
2022-07-14 22:02 ` Khalid Aziz
2022-07-18 12:59 ` David Hildenbrand
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=Yr4Xqe22CI/ff0ge@magnolia \
--to=djwong@kernel.org \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=ebiederm@xmission.com \
--cc=hagen@jauu.net \
--cc=jack@suse.cz \
--cc=keescook@chromium.org \
--cc=khalid.aziz@oracle.com \
--cc=kirill@shutemov.name \
--cc=kucharsk@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=longpeng2@huawei.com \
--cc=luto@kernel.org \
--cc=markhemm@googlemail.com \
--cc=pcc@google.com \
--cc=rppt@kernel.org \
--cc=sieberf@amazon.com \
--cc=sjpark@amazon.de \
--cc=surenb@google.com \
--cc=tst@schoebel-theuer.de \
--cc=willy@infradead.org \
--cc=yzaikin@google.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).