> > > > That's not an argument against moving it to BaseInit() though, as that's > called before procsignal is even initialized and before signals are > unmasked. >
Yes, OK. > I don't really understand why DSA_DEFAULT_INIT_SEGMENT_SIZE is > > > > something that makes sense to use here? > > > > > > > > To determine the memory limit per backend in multiples of > > DSA_DEFAULT_INIT_SEGMENT_SIZE. > > Currently it is set to 1 * DSA_DEFAULT_INIT_SEGMENT_SIZE. > > Since a call to dsa_create would create a DSA segment of this size, I > > thought it makes sense > > to define a limit related to the segment size. > > I strongly disagree. The limit should be in an understandable unit, not on > another subystems's defaults that might change at some point. > OK, makes sense. > > > > > + /* If the dsm mapping could not be found, attach to the area */ > > > > + if (dsm_seg != NULL) > > > > + return; > > > > > > I don't understand what we do here with the dsm? Why do we not need > > > cleanup > > > if we are already attached to the dsm segment? > > > > > > > I am not expecting to hit this case, since we are always detaching from > the > > dsa. > > Pretty sure it's reachable, consider a failure of dsa_allocate(). That'll > throw an error, while attached to the segment. > > You are right, I did not think of this scenario. > > > This could be an assert but since it is a cleanup code, I thought > returning > > would be a harmless step. > > The problem is that the code seems wrong - if we are already attached we'll > leak the memory! > > I understand your concern. One issue I recall is that we do not have a dsa_find_mapping function similar to dsm_find_mapping(). If I understand correctly, the only way to access an already attached DSA is to ensure we store the DSA area mapping in a global variable. I'm considering using a global variable and accessing it from the cleanup function in case it is already mapped. Does that sound fine? > As I also mentioned, I don't understand why we're constantly > attaching/detaching from the dsa/dsm either. It just seems to make things > more > complicated an dmore expensive. > OK, I see that this could be expensive if a process is periodically being queried for statistics. However, in scenarios where a process is queried only once for memory, statistics, keeping the area mapped would consume memory resources, correct? Thank you, Rahila Syed