All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Newall <david@davidnewall.com>
To: Russ Dill <russ.dill@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [OT] Argument with an OS professor over profile=3
Date: Thu, 11 Oct 2007 11:06:08 +0930	[thread overview]
Message-ID: <470D7E08.10209@davidnewall.com> (raw)
In-Reply-To: <f9d2a5e10710101708l707eb619l6446f2e648ee016e@mail.gmail.com>

Russ Dill wrote:
> I've been having a back and forth going for a while with my TA and OS
> professor on the meaning of profile=3 and have been unable to convince
> either of them. The basic question is if profile=3 is passed to kernel
> with an 8MB text section, how big is the allocated profile buffer. His
> answer is 1MB....
>
>         if (prof_shift) {
>                 unsigned int size;
>                 /* only text is profiled */
>                 prof_len = (unsigned *) &_etext - (unsigned *) &_stext;
>   
You stipulated 8MB text, but this calculates in unsigned ints, so 
prof_len = 2M.

>                 prof_len >>= prof_shift;
>   

This gives 250K (divide by 8).

>                 size = prof_len * sizeof(unsigned int) + PAGE_SIZE-1;
>   

Finally, size is 1MB (250K x 4).

>                 prof_buffer = (unsigned int *) alloc_bootmem(size);
>         }
>   

I'm with your Prof.  Perhaps you missed that prof_len counts integers, 
not bytes.

  parent reply	other threads:[~2007-10-11  1:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-11  0:08 [OT] Argument with an OS professor over profile=3 Russ Dill
2007-10-11  0:13 ` Russ Dill
2007-10-11  0:17   ` Jan Engelhardt
2007-10-11  1:36 ` David Newall [this message]
2007-10-11  1:50   ` Russ Dill

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=470D7E08.10209@davidnewall.com \
    --to=david@davidnewall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=russ.dill@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.