From: Dave Hansen <haveblue@us.ibm.com>
To: "Martin J. Bligh" <mbligh@mbligh.org>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] abstract out bits of ldt.c
Date: Mon, 08 Aug 2005 01:41:36 -0700 [thread overview]
Message-ID: <1123490496.10337.12.camel@localhost> (raw)
In-Reply-To: <372830000.1123456808@[10.10.2.4]>
On Sun, 2005-08-07 at 16:20 -0700, Martin J. Bligh wrote:
> Starting on the work to merge xen cleanly as a subarch.
> Introduce make_pages_readonly and make_pages_writable where appropriate
> for Xen, defined as a no-op on other subarches. Same for
> add_context_to_unpinned and del_context_from_unpinned.
> Abstract out install_ldt_entry()
...
> cpumask_t mask;
> preempt_disable();
> + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
> + PAGE_SIZE);
> load_LDT(pc);
> mask = cpumask_of_cpu(smp_processor_id());
> if (!cpus_equal(current->mm->cpu_vm_mask, mask))
> smp_call_function(flush_ldt, NULL, 1, 1);
> preempt_enable();
> #else
> + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) /
> + PAGE_SIZE);
You do that (size * LDT_ENTRY_SIZE / PAGE_SIZE) operation an awfully
large number of times. Could you consider introducing a little helper,
say ldt_size_pages()?
Or, could you have a helper like make_ldt_readonly()? You don't have to
export it, just use it in that one file.
> This will do have no effect whatsover on platforms other than xen.
...
> + memset(&mm->context, 0, sizeof(mm->context));
> init_MUTEX(&mm->context.sem);
> - mm->context.size = 0;
Could you please explain what this is for? It doesn't appear to be part
of the abstraction.
Every call path I can see to init_new_context() is immediately preceded
by mm_alloc(), which memsets the entire mm. The context is a direct
member of mm_struct, and should be zeroed along with the mm_alloc()
memset. So, this seems a bit superfluous.
In any future patches that you might post, please do one thing per
patch, it makes them much easier to audit.
-- Dave
prev parent reply other threads:[~2005-08-08 0:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-07 23:20 [PATCH] abstract out bits of ldt.c Martin J. Bligh
2005-08-07 23:44 ` Chris Wright
2005-08-07 23:57 ` Martin J. Bligh
2005-08-07 23:59 ` Chris Wright
2005-08-08 0:41 ` Andrew Morton
2005-08-08 0:46 ` Chris Wright
2005-08-08 1:04 ` Zachary Amsden
2005-08-08 1:08 ` Chris Wright
2005-08-08 1:16 ` Zachary Amsden
2005-08-08 1:36 ` Chris Wright
2005-08-08 1:21 ` Martin J. Bligh
2005-08-08 0:59 ` Martin J. Bligh
[not found] ` <20050808113014.GA15165@elte.hu>
[not found] ` <20050808095755.23810b15.akpm@osdl.org>
2005-08-09 9:23 ` Ingo Molnar
2005-08-09 9:28 ` Christoph Hellwig
2005-08-08 8:41 ` Dave Hansen [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=1123490496.10337.12.camel@localhost \
--to=haveblue@us.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@mbligh.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