From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F349C433EF for ; Thu, 30 Jun 2022 21:37:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 012988E0002; Thu, 30 Jun 2022 17:37:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDDBF8E0001; Thu, 30 Jun 2022 17:37:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA5D38E0002; Thu, 30 Jun 2022 17:37:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C75908E0001 for ; Thu, 30 Jun 2022 17:37:48 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 828896150D for ; Thu, 30 Jun 2022 21:37:48 +0000 (UTC) X-FDA: 79636214616.31.5C40A62 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf09.hostedemail.com (Postfix) with ESMTP id E7B5814000B for ; Thu, 30 Jun 2022 21:37:47 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79FB4B82D5D; Thu, 30 Jun 2022 21:37:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B0CAC341C8; Thu, 30 Jun 2022 21:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656625066; bh=/1mPg+HnK95Yhfa0x9xppZXAMpxCw2yRXLpQyUsVUs4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=okEDMuKgkx85z8wootjkayGx5wpPaISbSuvv2iz+k60DQnfW4MphYuCxOU9S+PM04 dKH+ZsGnlHJg6R+ydb0rmea9sbOcUNgNHvSMJwxknZkitlb6mOx8PeaY80hPWYU0YY v4FnFJj4ogxdv/ask676u11UFy1N9XJoICUtAFIGqoQrrBWM+H5sezK7bBEleXOl3q fwagwQYhsTRFZ9TqoB/hs8y8qAerOt/QwwVhe3OJKYnh1m7/RhdE0/Taas957m8GjA xtzc+HcsRKg3UneQB0DvMA3+LqH/J2B1MyytK1Kj9I5Aj0MFrYzb04sALfWxVvo/Ul H6E6oBx+2QCxw== Date: Thu, 30 Jun 2022 14:37:45 -0700 From: "Darrick J. Wong" To: Khalid Aziz 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 Message-ID: References: <34e2eabbef5916c784dc16856ce25b3967f9b405.1656531090.git.khalid.aziz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <34e2eabbef5916c784dc16856ce25b3967f9b405.1656531090.git.khalid.aziz@oracle.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656625068; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dcgBaK1xnnMJhM1W7R0mLbE/ynXEbp6DjqiyvRNJjmc=; b=oUrIxkr2JdFFhUbm6z06kuv+j89r1Ly9Er9RQvmB5VcGo6W6DqW48gjoyVXakTCGCNYC4h ufEuX1F5wY7qwtIpk1XGslLO0DZZatma/eOP5UQvRqTcQkqm4e1ZzSAkA8VvmiV2/UQXJU mn1Zg/wi7quvIOb34Ei0fRL47CkTIPM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656625068; a=rsa-sha256; cv=none; b=UMN/qFBvo+7D6GMk/ZJOAGZ3/ojhQv92Ts60p3GbxW29gAhtG1+3jsgcsQr51B44SRANp2 xgs4XVwzrntkig1zPMs9cZED7QmFi43w7IH76Z2vooxu8yT8i6jlN2E0IpOh0RoVXIqbhV JMzeMCYuXEKyjE9vcAssTbQvte6wqLk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=okEDMuKg; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of djwong@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=djwong@kernel.org Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=okEDMuKg; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf09.hostedemail.com: domain of djwong@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=djwong@kernel.org X-Rspamd-Server: rspam03 X-Rspam-User: X-Stat-Signature: yizygjuhc4zd96xmqk5kwp8kwcb3ewyw X-Rspamd-Queue-Id: E7B5814000B X-HE-Tag: 1656625067-514992 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > --- > 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 >