[Mauiusers] something wrong in class node features code

Garrick Staples garrick at usc.edu
Mon Oct 27 19:24:20 MDT 2008


I've been highly dependant on Maui's "neednodes" feature with torque classes
for many years.  We have lots of queues that divide up nearly 2700 nodes.
Recently, when I added a new queue, maui started doing the Wrong Thing.

It started adding random node features to class' configs, ie:
$ showconfig | grep CLASS
CLASSCFG[ghanem]  DEFAULT.FEATURES=[ghanem]
CLASSCFG[laird]  DEFAULT.FEATURES=[laird]
CLASSCFG[priya]  DEFAULT.FEATURES=[priya]
CLASSCFG[cmb]  DEFAULT.FEATURES=[X4100][cmb]

Where "X4100" isn't supposed to be there.  I was really baffled.  I've been
doing this for years, only making adjustments here and there as we added more
nodes and queues.


After walking the code a bit, I came across this bit that initially made me
suspect a 64bit problem, but I just get more confused the more I look at it:

MClass.c:MClassSetAttr() calls 
  MUGetMAttr(...,C->DefFBM,sizeof(C->DefFBM));
     (DefFBM is an array of ints)

MUtil.c:MUGetMAttr(...,int *AttrMap, int MapSize) calls
  MUBMClear(AttrMap,(MapSize << 3));

And MUBMClear is a define:
  #define MUBMClear(M,S) memset(M,0,sizeof(int) * ((S >> 5) + 1))


Why is the passed size of the array messed with so much?  I don't understand
what is happening.  A perfectly respectable 'sizeof(C->DefFBM)' turns into this
monstrosity by the time it gets to memset():
  sizeof(int) * ((((sizeof(C->DefFBM)) << 3) >> 5) + 1)


As it turns out, a 32bit build doesn't show the problem.  I'm now using a 32bit
on my 64bit server as a work-around.   I don't actually think this is a 64bit
problem, or if it is even my problem; but this code does seem wrong.

Now that I think about it, I think just the '+1' is messing it up (as long as
the assumption that sizeof(int)==4 holds up).

Oh, and this is the latest snapshot: maui-3.2.6p20-snap.1223069659.

-- 
Garrick Staples, GNU/Linux HPCC SysAdmin
University of Southern California

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.supercluster.org/pipermail/mauiusers/attachments/20081027/8bc11a83/attachment.bin


More information about the mauiusers mailing list