From: Hillf Danton <dhillf@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] MM: Support more pagesizes for MAP_HUGETLB/SHM_HUGETLB v5
Date: Sun, 14 Oct 2012 11:20:52 +0800 [thread overview]
Message-ID: <CAJd=RBD_yjZ+=MTT8Zj+O4BTOHNd3oCcVFTtqi29znhYqHiJGw@mail.gmail.com> (raw)
In-Reply-To: <1350142693-21954-1-git-send-email-andi@firstfloor.org>
Hi Andi,
On Sat, Oct 13, 2012 at 11:38 PM, Andi Kleen <andi@firstfloor.org> wrote:
> v2: Port to new tree. Fix unmount.
> v3: Ported to latest tree.
> v4: Ported to latest tree. Minor changes for review feedback. Updated
> description.
> v5: Remove unnecessary prototypes to fix merge error (Hillf Dalton)
s/Dalton/Danton/
> struct file *hugetlb_file_setup(const char *name, unsigned long addr,
> size_t size, vm_flags_t acctflag,
> - struct user_struct **user, int creat_flags)
> + struct user_struct **user,
> + int creat_flags, int page_size_log)
> {
> int error = -ENOMEM;
> struct file *file;
> @@ -944,9 +957,14 @@ struct file *hugetlb_file_setup(const char *name, unsigned long addr,
> struct qstr quick_string;
> struct hstate *hstate;
> unsigned long num_pages;
> + int hstate_idx;
> +
> + hstate_idx = get_hstate_idx(page_size_log);
> + if (hstate_idx < 0)
> + return ERR_PTR(-ENODEV);
>
> *user = NULL;
> - if (!hugetlbfs_vfsmount)
> + if (!hugetlbfs_vfsmount[hstate_idx])
Maybe
if (IS_ERR(hugetlbfs_vfsmount[hstate_idx]))
since ...
> static int __init init_hugetlbfs_fs(void)
> {
> + struct hstate *h;
> int error;
> - struct vfsmount *vfsmount;
> + int i;
>
> error = bdi_init(&hugetlbfs_backing_dev_info);
> if (error)
> @@ -1029,14 +1048,26 @@ static int __init init_hugetlbfs_fs(void)
> if (error)
> goto out;
>
> - vfsmount = kern_mount(&hugetlbfs_fs_type);
> + i = 0;
> + for_each_hstate (h) {
> + char buf[50];
> + unsigned ps_kb = 1U << (h->order + PAGE_SHIFT - 10);
>
> - if (!IS_ERR(vfsmount)) {
> - hugetlbfs_vfsmount = vfsmount;
> - return 0;
> - }
> + snprintf(buf, sizeof buf, "pagesize=%uK", ps_kb);
> + hugetlbfs_vfsmount[i] = kern_mount_data(&hugetlbfs_fs_type,
> + buf);
>
> - error = PTR_ERR(vfsmount);
> + if (IS_ERR(hugetlbfs_vfsmount[i])) {
> + pr_err(
> + "hugetlb: Cannot mount internal hugetlbfs for page size %uK",
> + ps_kb);
> + error = PTR_ERR(hugetlbfs_vfsmount[i]);
... hugetlbfs_vfsmount[i] is not reset.
> + }
> + i++;
> + }
> + /* Non default hstates are optional */
> + if (hugetlbfs_vfsmount[default_hstate_idx])
ditto.
BTW, resetting looks simpler?
> + return 0;
--
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>
prev parent reply other threads:[~2012-10-14 3:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-13 15:38 Andi Kleen
2012-10-14 3:20 ` Hillf Danton [this message]
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='CAJd=RBD_yjZ+=MTT8Zj+O4BTOHNd3oCcVFTtqi29znhYqHiJGw@mail.gmail.com' \
--to=dhillf@gmail.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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