public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: tj@kernel.org, xiyou.wangcong@gmail.com,
	kexec@lists.infradead.org, tim@edgecast.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH] percpu: add comment to per_cpu_ptr_to_phys
Date: Wed, 23 Nov 2011 16:45:43 +0800	[thread overview]
Message-ID: <20111123084543.GA2923@darkstar.nay.redhat.com> (raw)

add comments about current per_cpu_ptr_to_phys implementation
to explain why the logic is more complicated than necessary.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 mm/percpu.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- linux-2.6.orig/mm/percpu.c	2011-11-22 10:18:46.000000000 +0800
+++ linux-2.6/mm/percpu.c	2011-11-23 16:27:01.667562973 +0800
@@ -988,6 +988,19 @@ phys_addr_t per_cpu_ptr_to_phys(void *ad
 	unsigned int cpu;
 
 	/*
+	 * percpu allocator has special setup for the first chunk,
+	 * which currently supports either embedding in linear address space
+	 * or vmalloc mapping, and, from the second one, the backing
+	 * allocator (currently either vm or km) provides translation.
+	 *
+	 * The addr can be tranlated simply without checking if it falls
+	 * into the first chunk. But the current code reflects better
+	 * how percpu allocator actually works, and the verification can
+	 * discover both bugs in percpu allocator itself and
+	 * per_cpu_ptr_to_phys() callers. So we keep current code.
+	 */
+
+	/*
 	 * The following test on first_start/end isn't strictly
 	 * necessary but will speed up lookups of addresses which
 	 * aren't in the first chunk.

             reply	other threads:[~2011-11-23  8:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23  8:45 Dave Young [this message]
2011-11-23 16:22 ` [PATCH] percpu: add comment to per_cpu_ptr_to_phys Tejun Heo

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=20111123084543.GA2923@darkstar.nay.redhat.com \
    --to=dyoung@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim@edgecast.com \
    --cc=tj@kernel.org \
    --cc=xiyou.wangcong@gmail.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