diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:40:24 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:40:24 -0400 |
| commit | ec965350bb98bd291eb34f6ecddfdcfc36da1e6e (patch) | |
| tree | 983bcaf33ed00b48a86f7f8790cc460cf15dd252 /drivers/base/node.c | |
| parent | 5f033bb9bc5cb3bb37a79e3ef131f50ecdcb72b0 (diff) | |
| parent | 486fdae21458bd9f4e125099bb3c38a4064e450e (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched-devel
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched-devel: (62 commits)
sched: build fix
sched: better rt-group documentation
sched: features fix
sched: /debug/sched_features
sched: add SCHED_FEAT_DEADLINE
sched: debug: show a weight tree
sched: fair: weight calculations
sched: fair-group: de-couple load-balancing from the rb-trees
sched: fair-group scheduling vs latency
sched: rt-group: optimize dequeue_rt_stack
sched: debug: add some debug code to handle the full hierarchy
sched: fair-group: SMP-nice for group scheduling
sched, cpuset: customize sched domains, core
sched, cpuset: customize sched domains, docs
sched: prepatory code movement
sched: rt: multi level group constraints
sched: task_group hierarchy
sched: fix the task_group hierarchy for UID grouping
sched: allow the group scheduler to have multiple levels
sched: mix tasks and groups
...
Diffstat (limited to 'drivers/base/node.c')
| -rw-r--r-- | drivers/base/node.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c index e59861f18ce5..12fde2d03d69 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
| @@ -19,21 +19,34 @@ static struct sysdev_class node_class = { | |||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | static ssize_t node_read_cpumap(struct sys_device * dev, char * buf) | 22 | static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf) |
| 23 | { | 23 | { |
| 24 | struct node *node_dev = to_node(dev); | 24 | struct node *node_dev = to_node(dev); |
| 25 | cpumask_t mask = node_to_cpumask(node_dev->sysdev.id); | 25 | node_to_cpumask_ptr(mask, node_dev->sysdev.id); |
| 26 | int len; | 26 | int len; |
| 27 | 27 | ||
| 28 | /* 2004/06/03: buf currently PAGE_SIZE, need > 1 char per 4 bits. */ | 28 | /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */ |
| 29 | BUILD_BUG_ON(MAX_NUMNODES/4 > PAGE_SIZE/2); | 29 | BUILD_BUG_ON((NR_CPUS/32 * 9) > (PAGE_SIZE-1)); |
| 30 | 30 | ||
| 31 | len = cpumask_scnprintf(buf, PAGE_SIZE-1, mask); | 31 | len = type? |
| 32 | len += sprintf(buf + len, "\n"); | 32 | cpulist_scnprintf(buf, PAGE_SIZE-2, *mask): |
| 33 | cpumask_scnprintf(buf, PAGE_SIZE-2, *mask); | ||
| 34 | buf[len++] = '\n'; | ||
| 35 | buf[len] = '\0'; | ||
| 33 | return len; | 36 | return len; |
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumap, NULL); | 39 | static inline ssize_t node_read_cpumask(struct sys_device *dev, char *buf) |
| 40 | { | ||
| 41 | return node_read_cpumap(dev, 0, buf); | ||
| 42 | } | ||
| 43 | static inline ssize_t node_read_cpulist(struct sys_device *dev, char *buf) | ||
| 44 | { | ||
| 45 | return node_read_cpumap(dev, 1, buf); | ||
| 46 | } | ||
| 47 | |||
| 48 | static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); | ||
| 49 | static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); | ||
| 37 | 50 | ||
| 38 | #define K(x) ((x) << (PAGE_SHIFT - 10)) | 51 | #define K(x) ((x) << (PAGE_SHIFT - 10)) |
| 39 | static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) | 52 | static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) |
| @@ -149,6 +162,7 @@ int register_node(struct node *node, int num, struct node *parent) | |||
| 149 | 162 | ||
| 150 | if (!error){ | 163 | if (!error){ |
| 151 | sysdev_create_file(&node->sysdev, &attr_cpumap); | 164 | sysdev_create_file(&node->sysdev, &attr_cpumap); |
| 165 | sysdev_create_file(&node->sysdev, &attr_cpulist); | ||
| 152 | sysdev_create_file(&node->sysdev, &attr_meminfo); | 166 | sysdev_create_file(&node->sysdev, &attr_meminfo); |
| 153 | sysdev_create_file(&node->sysdev, &attr_numastat); | 167 | sysdev_create_file(&node->sysdev, &attr_numastat); |
| 154 | sysdev_create_file(&node->sysdev, &attr_distance); | 168 | sysdev_create_file(&node->sysdev, &attr_distance); |
| @@ -166,6 +180,7 @@ int register_node(struct node *node, int num, struct node *parent) | |||
| 166 | void unregister_node(struct node *node) | 180 | void unregister_node(struct node *node) |
| 167 | { | 181 | { |
| 168 | sysdev_remove_file(&node->sysdev, &attr_cpumap); | 182 | sysdev_remove_file(&node->sysdev, &attr_cpumap); |
| 183 | sysdev_remove_file(&node->sysdev, &attr_cpulist); | ||
| 169 | sysdev_remove_file(&node->sysdev, &attr_meminfo); | 184 | sysdev_remove_file(&node->sysdev, &attr_meminfo); |
| 170 | sysdev_remove_file(&node->sysdev, &attr_numastat); | 185 | sysdev_remove_file(&node->sysdev, &attr_numastat); |
| 171 | sysdev_remove_file(&node->sysdev, &attr_distance); | 186 | sysdev_remove_file(&node->sysdev, &attr_distance); |
