Skip to content

Commit

Permalink
kmem_log_init() called with too large alloc for 128G+ RAM systems
Browse files Browse the repository at this point in the history
As the transaction_log_sizes are calculated by "total_memory / 50", (that's
literally 50, not percent) the requested log size is (eventually) 2G which
will never be honoured by XNU.

In addition, the production build had SPL in debug (KMF_CONTENTS) which is
quite expensive, disabled by default now.
  • Loading branch information
lundman committed May 11, 2016
1 parent a89a379 commit a0c6288
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions module/spl/spl-kmem.c
Expand Up @@ -49,7 +49,7 @@
//#define PRINT_CACHE_STATS 1

// Uncomment to turn on kmems' debug features.
#define DEBUG 1
//#define DEBUG 1
#define dprintf if(0) printf

//===============================================================
Expand Down Expand Up @@ -4642,13 +4642,15 @@ spl_kmem_init(uint64_t xtotal_memory)

if (kmem_flags & (KMF_AUDIT | KMF_RANDOMIZE)) {
if (kmem_transaction_log_size == 0)
kmem_transaction_log_size = kmem_maxavail() / 50;
kmem_transaction_log_size = MIN(kmem_maxavail() / 50ULL,
KMEM_QUANTUM<<4);
kmem_transaction_log = kmem_log_init(kmem_transaction_log_size);
}

if (kmem_flags & (KMF_CONTENTS | KMF_RANDOMIZE)) {
if (kmem_content_log_size == 0)
kmem_content_log_size = kmem_maxavail() / 50;
kmem_content_log_size = MIN(kmem_maxavail() / 50ULL,

This comment has been minimized.

Copy link
@rottegift

rottegift May 11, 2016

Contributor

Are you sure you want to remove the ULL type indicator here? Hasn't that bitten us before?

This comment has been minimized.

Copy link
@lundman

lundman May 11, 2016

Author Contributor

Removed? I thought I added it "just in case".

KMEM_QUANTUM<<4);
kmem_content_log = kmem_log_init(kmem_content_log_size);
}

Expand Down

0 comments on commit a0c6288

Please sign in to comment.