diff options
author | gamanakis | 2018-02-22 21:24:12 -0500 |
---|---|---|
committer | gamanakis | 2018-02-22 21:24:12 -0500 |
commit | b651d0376889cd820c9ae23397ed84e227e20a48 (patch) | |
tree | 1edec399a935c464a44e37bebdd1aa5b9d18d1f6 | |
download | aur-b651d0376889cd820c9ae23397ed84e227e20a48.tar.gz |
Initial release
-rw-r--r-- | .SRCINFO | 17 | ||||
-rw-r--r-- | 0001-remove-exclusivity.patch | 13 | ||||
-rw-r--r-- | PKGBUILD | 27 | ||||
-rw-r--r-- | add-cpuset-prefix.patch | 148 |
4 files changed, 205 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..560ba17eadb6 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,17 @@ +pkgbase = cpuset + pkgdesc = Cpuset is a Python application to make using the cpusets facilities in the Linux kernel easier. + pkgver = r59.02ef9e0 + pkgrel = 1 + url = https://github.com/lpechacek/cpuset/ + arch = any + license = GPL2 + depends = python + depends = python-future + options = !emptydirs + source = git+https://github.com/lpechacek/cpuset + source = 0001-remove-exclusivity.patch + md5sums = SKIP + md5sums = f944918002bde0e949a694741309fda8 + +pkgname = cpuset + diff --git a/0001-remove-exclusivity.patch b/0001-remove-exclusivity.patch new file mode 100644 index 000000000000..4f32866a54a7 --- /dev/null +++ b/0001-remove-exclusivity.patch @@ -0,0 +1,13 @@ +--- a/cpuset/commands/shield.py 2018-02-22 12:56:37.000000000 -0500 ++++ b/cpuset/commands/shield.py 2018-02-22 12:58:00.748829750 -0500 +@@ -396,8 +396,8 @@ def make_shield(cpuspec, kthread): + set.modify(USR_SET, cpuspec, memspec, False, False) + set.modify(SYS_SET, cpuspec_inv, memspec, False, False) + # reset cpu exlusivity +- cset.unique_set(USR_SET).cpu_exclusive = True +- cset.unique_set(SYS_SET).cpu_exclusive = True ++ ##cset.unique_set(USR_SET).cpu_exclusive = True ++ ##cset.unique_set(SYS_SET).cpu_exclusive = True + log.info('--> shielding modified with:') + # move root tasks into system set + root_tasks = cset.unique_set('/').tasks diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..2867e96b8f49 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,27 @@ +# Maintainer: Jon Gjengset <jon@thesquareplanet.com>, Saren Arterius <saren@wtako.net> +# Maintainer: George Amanakis<gamanakis@gmail.com> +pkgname=cpuset +pkgver=r59.02ef9e0 +pkgver() { + cd "$pkgname" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} +pkgrel=1 +pkgdesc="Cpuset is a Python application to make using the cpusets facilities in the Linux kernel easier." +arch=('any') +url="https://github.com/lpechacek/cpuset/" +license=('GPL2') +depends=('python' 'python-future') +options=('!emptydirs') +# 0001-remove-exclusivity.patch removes setting cpu_exclusive and mem_exclusive to 1, +# thus enabling cpuset to run even when a machine.slice has been created and cannot be modified +source=('git+https://github.com/lpechacek/cpuset' + '0001-remove-exclusivity.patch') +md5sums=('SKIP' + 'f944918002bde0e949a694741309fda8') + +package() { + cd "$srcdir/$pkgname" + patch -p1 -i ../0001-remove-exclusivity.patch + python setup.py install --root="$pkgdir/" --optimize=1 +} diff --git a/add-cpuset-prefix.patch b/add-cpuset-prefix.patch new file mode 100644 index 000000000000..ba79915d2d5c --- /dev/null +++ b/add-cpuset-prefix.patch @@ -0,0 +1,148 @@ +--- a/cpuset/cset.py 2010-08-01 16:19:49.000000000 -0400 ++++ b/cpuset/cset.py 2015-07-07 17:53:05.712530891 -0400 +@@ -32,10 +32,13 @@ + class CpuSet(object): + # sets is a class variable dict that keeps track of all + # cpusets discovered such that we can link them in properly. +- # The basepath is it's base path, the sets are indexed via ++ # The basepath is its base path, the sets are indexed via + # a relative path from this basepath. ++ # prefix can be empty or 'cpuset.' in case the filesystem ++ # has its own namespace + sets = {} + basepath = '' ++ prefix = '' + + def __init__(self, path=None): + log.debug("initializing CpuSet") +@@ -47,7 +50,16 @@ + log.debug("finding all cpusets") + path = self.locate_cpusets() + CpuSet.basepath = path +- log.debug("creating root node at %s", path) ++ if not os.access(path + '/cpus', os.F_OK): ++ log.debug(path + "/cpus doesn't exist, trying to add the cpuset. prefix") ++ CpuSet.prefix = 'cpuset.' ++ if not os.access(path + '/cpuset.cpus', os.F_OK): ++ # definitely not a cpuset directory ++ str = '%s is not a cpuset directory' % (path) ++ log.error(str) ++ raise CpusetException(str) ++ ++ log.debug("creating root node at %s with prefix '%s'", path, CpuSet.prefix) + self.__root = True + self.name = 'root' + self.path = '/' +@@ -56,6 +68,7 @@ + del CpuSet.sets + CpuSet.sets = {} + CpuSet.sets[self.path] = self ++ + # bottom-up search otherwise links will not exist + log.debug("starting bottom-up discovery walk...") + for dir, dirs, files in os.walk(path, topdown=False): +@@ -104,12 +117,18 @@ + log.debug("the cpuset %s already exists, skipping", path) + self = CpuSet.sets[path] # questionable.... + return +- cpus = CpuSet.basepath + path + "/cpus" ++ cpus = CpuSet.basepath + path + '/' + CpuSet.prefix + "cpus" + if not os.access(cpus, os.F_OK): +- # not a cpuset directory +- str = '%s is not a cpuset directory' % (CpuSet.basepath + path) +- log.error(str) +- raise CpusetException(str) ++ log.debug(cpus + " doesn't exist, trying to add the cpuset. prefix") ++ CpuSet.prefix = 'cpuset.' ++ cpus = CpuSet.basepath + path + '/' + CpuSet.prefix + "cpus" ++ if not os.access(cpus, os.F_OK): ++ # definitely not a cpuset directory ++ str = '%s is not a cpuset directory' % (CpuSet.basepath + path) ++ log.error(str) ++ raise CpusetException(str) ++ else: ++ log.debug(cpus + " successfully found") + self.__root = False + self.read_cpuset(path) + CpuSet.sets[path] = self +@@ -158,36 +177,36 @@ + raise AttributeError, "deletion of properties not allowed" + + def getcpus(self): +- f = file(CpuSet.basepath+self.path+"/cpus") ++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"cpus") + return f.readline()[:-1] + def setcpus(self, newval): + cpuspec_check(newval) +- f = file(CpuSet.basepath+self.path+"/cpus",'w') ++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"cpus",'w') + f.write(str(newval)) + f.close() + log.debug("-> prop_set %s.cpus = %s", self.path, newval) + cpus = property(fget=getcpus, fset=setcpus, fdel=delprop, doc="CPU specifier") + + def getmems(self): +- f = file(CpuSet.basepath+self.path+"/mems") ++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"mems") + return f.readline()[:-1] + def setmems(self, newval): + # FIXME: check format for correctness +- f = file(CpuSet.basepath+self.path+"/mems",'w') ++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"mems",'w') + f.write(str(newval)) + f.close() + log.debug("-> prop_set %s.mems = %s", self.path, newval) + mems = property(getmems, setmems, delprop, "Mem node specifier") + + def getcpuxlsv(self): +- f = file(CpuSet.basepath+self.path+"/cpu_exclusive") ++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"cpu_exclusive") + if f.readline()[:-1] == '1': + return True + else: + return False + def setcpuxlsv(self, newval): + log.debug("-> prop_set %s.cpu_exclusive = %s", self.path, newval) +- f = file(CpuSet.basepath+self.path+"/cpu_exclusive",'w') ++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"cpu_exclusive",'w') + if newval: + f.write('1') + else: +@@ -197,14 +216,14 @@ + "CPU exclusive flag") + + def getmemxlsv(self): +- f = file(CpuSet.basepath+self.path+"/mem_exclusive") ++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"mem_exclusive") + if f.readline()[:-1] == '1': + return True + else: + return False + def setmemxlsv(self, newval): + log.debug("-> prop_set %s.mem_exclusive = %s", self.path, newval) +- f = file(CpuSet.basepath+self.path+"/mem_exclusive",'w') ++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"mem_exclusive",'w') + if newval: + f.write('1') + else: +@@ -214,6 +233,7 @@ + "Memory exclusive flag") + + def gettasks(self): ++ # 'tasks' never seem to have a possible 'cpusets.' prefix + f = file(CpuSet.basepath+self.path+"/tasks") + lst = [] + for task in f: lst.append(task[:-1]) +@@ -229,6 +249,7 @@ + prog = False + for task in tasklist: + try: ++ # 'tasks' never seem to have a possible 'cpusets.' prefix + f = file(CpuSet.basepath+self.path+"/tasks",'w') + f.write(task) + f.close() +@@ -513,4 +534,3 @@ + print 'Found "cantfindmenoway??!? -> ', node + except CpusetException, err: + print 'Caught exeption for non-existant set (correctly)-> ', err +- |