Re: separating out memory checks from INVARIANTS



On Sat, 15 Mar 2008, Kip Macy wrote:

On Sat, Mar 15, 2008 at 10:54 PM, Jeff Roberson
<jroberson@xxxxxxxxxxxxxx> wrote:

On Sat, 15 Mar 2008, Kip Macy wrote:

> I find that the serialization of memory allocation frequently hides
> race conditions. I would like to, at the very least, add an option to
> disable the memory checks if not make the memory checks a completely
> separate option. My knee jerk reaction to avoiding bikesheds is to
> simply add it to my own tree and forget about it. However, this has
> come up often enough that I feel that it warrants consideration.
>
>
> Thoughts?

One other option that I have frequently considered is to convert UMA from
using an array of bytes to using bitfields to represent the free space in
a slab. Then you could use atomics to update the required information.
It'd be a bit of work. Maybe a good SoC? :)


Would it make it possible to do memory allocation without holding a
lock in the M_NOWAIT case?

Yes, when I originally wrote the code it didn't require a lock because I relied on byte writes being atomic. However, we had platforms for which that wasn't true. (alpha). It may be that it's safe not to lock even now on x86/amd64. I don't know the specifics of the memory architectures on powerpc, arm, mips, etc. though.

Jeff


-Kip

_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: allocating memory.
    ... So what would be the ASM equivalent of new memory ... Memory allocation is primarily an OS responsibility, ... OSes are almost certainly responsible for memory ...
    (alt.lang.asm)
  • Re: Doubts on Defining and declaring variables
    ... 1.Dim iage ... and allocate memory for each of them ... My understanding:-Still No memory allocation done at this ... Now since string is assigned to iage,So will ...
    (microsoft.public.scripting.vbscript)
  • Re: xmalloc string functions
    ... require memory allocations depending on the way the system works. ... Not enough context for most real-world applications to ... It is /more/ reliable to routinely auto-save the user's work (as you ... particularly if your auto-save code is robust against memory allocation ...
    (comp.lang.c)
  • Re: "Criticism of the C programming language ??????"
    ... whatever) is that GC only affects memory allocated by GC_malloc. ... other applications and third party libraries will use it too? ... I didn't see how that could be true since, like KT, I was thinking of garbage collection integrated into the language itself. ... In a later message, after a burst of silly and pointless sarcasm, you were persuaded to explain that you were talking about an additional memory allocation library which would support garbage collection for memory it controlled. ...
    (comp.lang.c)
  • Re: Steady State ?
    ... It helps when you provide the context for the quote. ... which places special emphasis on memory allocation issues ... In the context of the article, non-fragmenting memory allocation ... If dynamic memory allocation is added in, ...
    (comp.lang.c)