mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: Scott Bronson <bronson@rinspin.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Getting the page size of currently running kernel
Date: Sat, 19 Feb 2005 19:28:27 -0800	[thread overview]
Message-ID: <521xbbucys.fsf@topspin.com> (raw)
In-Reply-To: <200502191901.57425.bronson@rinspin.com> (Scott Bronson's message of "Sat, 19 Feb 2005 19:01:57 -0800")

    Scott> Is there any way to get a running kernel to tell you the
    Scott> size of its pages?  Why: I'm writing a quick Perl hack to
    Scott> monitor the memory usage of the TCP stack over time.  Easy
    Scott> enough: /proc/net/sockstat gives the current value of
    Scott> tcp_memory_allocated.  But how do I convert this into
    Scott> bytes?  I don't want to hard code PAGE_SIZE into my Perl
    Scott> script, complete with a lookup table for 4K vs. 8K
    Scott> architectures!  Am I missing something obvious here?

I'm not sure exactly how to call it from perl, but from C one can use
sysconf(3) like:

	page_size = sysconf(_SC_PAGESIZE);

(one can also use getpagesize(2) to do exactly the same thing)

 - R.

  parent reply	other threads:[~2005-02-20  3:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-20  3:01 Scott Bronson
2005-02-20  3:22 ` Jan Knutar
2005-02-20  3:28 ` Roland Dreier [this message]
2005-02-20  4:39   ` Scott Bronson

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=521xbbucys.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=bronson@rinspin.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®