From: Eric B Munson <ebmunson@us.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linuxppc-dev@ozlabs.org,
libhugetlbfs-devel@lists.sourceforge.net
Subject: Re: [RFC] [PATCH 0/5 V2] Huge page backed user-space stacks
Date: Wed, 30 Jul 2008 08:08:11 -0700 [thread overview]
Message-ID: <20080730150811.GB20465@us.ibm.com> (raw)
In-Reply-To: <20080730014139.39b3edc5.akpm@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 2985 bytes --]
/***************************************************************************
* User front end for using huge pages Copyright (C) 2008, IBM *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the Lesser GNU General Public License as *
* published by the Free Software Foundation; either version 2.1 of the *
* License, or at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the Lesser GNU General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#define _GNU_SOURCE /* for getopt_long */
#include <unistd.h>
#include <getopt.h>
#include <sys/personality.h>
/* Peronsality bit for huge page backed stack */
#ifndef HUGETLB_STACK
#define HUGETLB_STACK 0x0020000
#endif
extern int errno;
extern int optind;
extern char *optarg;
void print_usage()
{
fprintf(stderr, "hugectl [options] target\n");
fprintf(stderr, "options:\n");
fprintf(stderr, " --help, -h Prints this message.\n");
fprintf(stderr,
" --stack, -s Attempts to execute target program with a hugtlb page backed stack.\n");
}
void set_huge_stack()
{
char * err;
unsigned long curr_per = personality(0xffffffff);
if (personality(curr_per | HUGETLB_STACK) == -1) {
err = strerror(errno);
fprintf(stderr,
"Error setting HUGE_STACK personality flag: '%s'\n",
err);
exit(-1);
}
}
int main(int argc, char** argv)
{
char opts [] = "+hs";
int ret = 0, index = 0;
struct option long_opts [] = {
{"help", 0, 0, 'h'},
{"stack", 0, 0, 's'},
{0, 0, 0, 0},
};
if (argc < 2) {
print_usage();
return 0;
}
while (ret != -1) {
ret = getopt_long(argc, argv, opts, long_opts, &index);
switch (ret) {
case 's':
set_huge_stack();
break;
case '?':
case 'h':
print_usage();
return 0;
case -1:
break;
default:
ret = -1;
break;
}
}
index = optind;
if (execvp(argv[index], &argv[index]) == -1) {
ret = errno;
fprintf(stderr, "Error calling execvp: '%s'\n", strerror(ret));
return ret;
}
return 0;
}
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2008-07-30 15:08 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 19:17 Eric Munson
2008-07-28 19:17 ` [PATCH 1/5 V2] Align stack boundaries based on personality Eric Munson
2008-07-28 20:09 ` Dave Hansen
2008-07-28 19:17 ` [PATCH 2/5 V2] Add shared and reservation control to hugetlb_file_setup Eric Munson
2008-07-28 19:17 ` [PATCH 3/5] Split boundary checking from body of do_munmap Eric Munson
2008-07-28 19:17 ` [PATCH 4/5 V2] Build hugetlb backed process stacks Eric Munson
2008-07-28 20:37 ` Dave Hansen
2008-07-28 19:17 ` [PATCH 5/5 V2] [PPC] Setup stack memory segment for hugetlb pages Eric Munson
2008-07-28 20:33 ` [RFC] [PATCH 0/5 V2] Huge page backed user-space stacks Dave Hansen
2008-07-28 21:23 ` Eric B Munson
2008-07-30 8:41 ` Andrew Morton
2008-07-30 15:04 ` Eric B Munson
2008-07-30 15:08 ` Eric B Munson [this message]
2008-07-30 8:43 ` Andrew Morton
2008-07-30 17:23 ` Mel Gorman
2008-07-30 17:34 ` Andrew Morton
2008-07-30 19:30 ` Mel Gorman
2008-07-30 19:40 ` Christoph Lameter
2008-07-30 20:07 ` Andrew Morton
2008-07-31 10:31 ` Mel Gorman
2008-08-04 21:10 ` Dave Hansen
2008-08-05 11:11 ` Mel Gorman
2008-08-05 16:12 ` Dave Hansen
2008-08-05 16:28 ` Mel Gorman
2008-08-05 17:53 ` Dave Hansen
2008-08-06 9:02 ` Mel Gorman
2008-08-06 19:50 ` Dave Hansen
2008-08-07 16:06 ` Mel Gorman
2008-08-07 17:29 ` Dave Hansen
2008-08-11 8:04 ` Mel Gorman
2008-07-31 6:04 ` Nick Piggin
2008-07-31 6:14 ` Andrew Morton
2008-07-31 6:26 ` Nick Piggin
2008-07-31 11:27 ` Mel Gorman
2008-07-31 11:51 ` Nick Piggin
2008-07-31 13:50 ` Mel Gorman
2008-07-31 14:32 ` Michael Ellerman
2008-08-06 18:49 ` Andi Kleen
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=20080730150811.GB20465@us.ibm.com \
--to=ebmunson@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=libhugetlbfs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@ozlabs.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