In certain circumstances, the current CG_VALUE_MAX value of 100 can lead to
unexpected behavior when needing to pass string values larger than 100
characters, if one didn't know about this value size limit. A specific
example of this situation is when a machine has 128 logical cores, and a
comma-separated list of logical cpu ids is being set on cpuset.cpus

Example:

"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63"

Which turns into the truncated string of:

"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36\x01"

And produces an error.

This patch increases CG_VALUE_MAX to 1024, which seems to be a more
reasonable value to cover unrolled cpuset.cpus values.


Signed-off-by: Justin Israel <justinisr...@gmail.com>
---

diff --git a/include/libcgroup/iterators.h b/include/libcgroup/iterators.h
index c6d453d..1d906c2 100644
--- a/include/libcgroup/iterators.h
+++ b/include/libcgroup/iterators.h
@@ -225,7 +225,7 @@ int cgroup_read_value_end(void **handle);
 /**
  * Maximum length of a value in stats file.
  */
-#define CG_VALUE_MAX 100
+#define CG_VALUE_MAX 1024
 /**
  * One item in stats file.
  */
------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to