[PATCH] Re: Plugable passdb (SAM) modules

James jas88 at cam.ac.uk
Thu Jan 24 06:00:09 GMT 2002


On Thursday 24 January 2002 12:07 pm, Andreas Moroder wrote:
> Hello Andrew,
>
> you wrote
>
> > Incorrect.  The whole of smbd's executable image is shared betwen all
> > processes running smbd.  Furthermore, all data structures that exist at
> > fork() time (on linux in particular) only once until they are modified.
>
> I know i am a little out of topic.
> What you wrote is correct but  .Data segments are not shared, because they
> are writable. Why aren't all the structures that contain constant data
> defined as const ?

This would make no difference: the data pages WILL be shared, until they are 
changed. The pages are NOT copied when a process forks, on modern Unix 
platforms - merely marked "copy-on-write". Provided Samba doesn't write to 
these variables, adding const shouldn't change anything. (What might help is 
hinting to the compiler/linker how to lay out variables in memory, but that's 
a different issue - has anyone seen anything about this recently?)

> I did post a patch months ago that was never applied . With few changes the
> memory usage could be shrinked by many Kb's

Not by adding const it won't...

(This change may cut *swap* usage on some platforms - Solaris? - which 
preallocate swap-space in anticipation of the COW pages being written to, but 
that's a much smaller issue I suspect.)


James.




More information about the samba-technical mailing list