static bool sb_transfer_first_span(char *base, sb_heap *heap,
int fromclass, int toclass);
static bool sb_try_to_steal_superblock(char *base, sb_allocator *a,
- uint16 heapproc, uint16 size_class);
+ uint16 size_class);
/*
* Create a backend-private allocator.
errmsg("out of memory")));
a->private = true;
- a->heaps_per_size_class = 1;
a->num_size_classes = num_size_classes;
for (heapno = 0; heapno < num_size_classes; ++heapno)
{
Size npages = fpm_size_to_pages(size);
Size first_page;
sb_span *span;
- int heapproc = MyProcPid % a->heaps_per_size_class;
- int heapno = heapproc * SB_NUM_SIZE_CLASSES + SB_SCLASS_SPAN_LARGE;
- sb_heap *heap = &a->heaps[heapno];
+ sb_heap *heap = &a->heaps[SB_SCLASS_SPAN_LARGE];
LWLock *lock = relptr_access(base, heap->lock);
void *ptr;
sb_reset_allocator(sb_allocator *a)
{
char *base = NULL;
- int num_heaps;
int heapno;
/*
* Iterate through heaps back to front. We do it this way so that
* spans-of-spans are freed last.
*/
- num_heaps = a->heaps_per_size_class * (int) a->num_size_classes;
- for (heapno = num_heaps; heapno >= 0; --heapno)
+ for (heapno = a->num_size_classes; heapno >= 0; --heapno)
{
sb_heap *heap = &a->heaps[heapno];
Size fclass;
static char *
sb_alloc_guts(char *base, sb_region *region, sb_allocator *a, int size_class)
{
- int heapproc = MyProcPid % a->heaps_per_size_class;
- int heapno = heapproc * SB_NUM_SIZE_CLASSES + size_class;
- sb_heap *heap = &a->heaps[heapno];
+ sb_heap *heap = &a->heaps[size_class];
LWLock *lock = relptr_access(base, heap->lock);
char *result = NULL;
Size obsize;
*/
if (result == NULL)
{
- if (a->heaps_per_size_class > 1 &&
- sb_try_to_steal_superblock(base, a, heapproc, size_class))
+ if (sb_try_to_steal_superblock(base, a, size_class))
{
/* The superblock we stole shouldn't full, so this should work. */
result = sb_alloc_from_heap(base, heap, obsize, nmax);
* Returns true if we succeed in stealing one, and false if not.
*/
static bool
-sb_try_to_steal_superblock(char *base, sb_allocator *a,
- uint16 heapproc, uint16 size_class)
+sb_try_to_steal_superblock(char *base, sb_allocator *a, uint16 size_class)
{
/* XXX */
return false;