Skip to content

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
git-svn-id: https://irqbalance.googlecode.com/svn/trunk@2 46b42954-3823-0410-bd82-eb80b452c9b5
  • Loading branch information
arjanvandeven committed Dec 9, 2006
1 parent f34ec17 commit 95f9881
Show file tree
Hide file tree
Showing 19 changed files with 3,689 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CFLAGS+=-g -Os -D_FORTIFY_SOURCE=2 -Wall -W `pkg-config --cflags glib-2.0`

all: irqbalance

LIBS=bitmap.o irqbalance.o cputree.o procinterrupts.o irqlist.o placement.o activate.o network.o powermode.o numa.o classify.o

irqbalance: .depend $(LIBS)
gcc -g -O2 -D_FORTIFY_SOURCE=2 -Wall `pkg-config --libs glib-2.0` $(LIBS) -o irqbalance

clean:
rm -f irqbalance *~ *.o .depend

# rule for building dependency lists, and writing them to a file
# named ".depend".
.depend:
rm -f .depend
gccmakedep -f- -- $(CFLAGS) -- *.c > .depend
57 changes: 57 additions & 0 deletions activate.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2006, Intel Corporation
*
* This file is part of irqbalance
*
* This program file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; version 2 of the License.
*
* 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 General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program in a file named COPYING; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

/*
* This file contains the code to communicate a selected distribution / mapping
* of interrupts to the kernel.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>

#include "irqbalance.h"


void activate_mapping(void)
{
struct interrupt *irq;
GList *iter;

iter = g_list_first(interrupts);
while (iter) {
irq = iter->data;
iter = g_list_next(iter);

if (!cpus_equal(irq->mask, irq->old_mask)) {
char buf[PATH_MAX];
FILE *file;
sprintf(buf, "/proc/irq/%i/smp_affinity", irq->number);
file = fopen(buf, "w");
if (!file)
continue;
cpumask_scnprintf(buf, PATH_MAX, irq->mask);
fprintf(file,"%s", buf);
fclose(file);
irq->old_mask = irq->mask;
}
}
}
Loading

0 comments on commit 95f9881

Please sign in to comment.