~ubuntu-branches/ubuntu/wily/spl-linux/wily

« back to all changes in this revision

Viewing changes to include/sys/kmem.h

  • Committer: Package Import Robot
  • Author(s): Liang Guo
  • Date: 2014-07-31 15:16:53 UTC
  • Revision ID: package-import@ubuntu.com-20140731151653-tgao12alohj26jcs
Tags: upstream-0.6.3+git20140731
ImportĀ upstreamĀ versionĀ 0.6.3+git20140731

Show diffs side-by-side

added added

removed removed

Lines of Context:
340
340
        KMC_BIT_QCACHE          = 4,    /* XXX: Unsupported */
341
341
        KMC_BIT_KMEM            = 5,    /* Use kmem cache */
342
342
        KMC_BIT_VMEM            = 6,    /* Use vmem cache */
343
 
        KMC_BIT_OFFSLAB         = 7,    /* Objects not on slab */
344
 
        KMC_BIT_NOEMERGENCY     = 8,    /* Disable emergency objects */
 
343
        KMC_BIT_SLAB            = 7,    /* Use Linux slab cache */
 
344
        KMC_BIT_OFFSLAB         = 8,    /* Objects not on slab */
 
345
        KMC_BIT_NOEMERGENCY     = 9,    /* Disable emergency objects */
345
346
        KMC_BIT_DEADLOCKED      = 14,   /* Deadlock detected */
346
347
        KMC_BIT_GROWING         = 15,   /* Growing in progress */
347
348
        KMC_BIT_REAPING         = 16,   /* Reaping in progress */
367
368
#define KMC_QCACHE              (1 << KMC_BIT_QCACHE)
368
369
#define KMC_KMEM                (1 << KMC_BIT_KMEM)
369
370
#define KMC_VMEM                (1 << KMC_BIT_VMEM)
 
371
#define KMC_SLAB                (1 << KMC_BIT_SLAB)
370
372
#define KMC_OFFSLAB             (1 << KMC_BIT_OFFSLAB)
371
373
#define KMC_NOEMERGENCY         (1 << KMC_BIT_NOEMERGENCY)
372
374
#define KMC_DEADLOCKED          (1 << KMC_BIT_DEADLOCKED)
383
385
#define KMC_EXPIRE_AGE          0x1     /* Due to age */
384
386
#define KMC_EXPIRE_MEM          0x2     /* Due to low memory */
385
387
 
 
388
#define KMC_RECLAIM_ONCE        0x1     /* Force a single shrinker pass */
 
389
 
386
390
extern unsigned int spl_kmem_cache_expire;
387
391
extern struct list_head spl_kmem_cache_list;
388
392
extern struct rw_semaphore spl_kmem_cache_sem;
456
460
        spl_kmem_reclaim_t      skc_reclaim;    /* Reclaimator */
457
461
        void                    *skc_private;   /* Private data */
458
462
        void                    *skc_vmp;       /* Unused */
 
463
        struct kmem_cache       *skc_linux_cache; /* Linux slab cache if used */
459
464
        unsigned long           skc_flags;      /* Flags */
460
465
        uint32_t                skc_obj_size;   /* Object size */
461
466
        uint32_t                skc_obj_align;  /* Object alignment */
513
518
#define kmem_virt(ptr)                  (((ptr) >= (void *)VMALLOC_START) && \
514
519
                                         ((ptr) <  (void *)VMALLOC_END))
515
520
 
 
521
/*
 
522
 * Allow custom slab allocation flags to be set for KMC_SLAB based caches.
 
523
 * One use for this function is to ensure the __GFP_COMP flag is part of
 
524
 * the default allocation mask which ensures higher order allocations are
 
525
 * properly refcounted.  This flag was added to the default ->allocflags
 
526
 * as of Linux 3.11.
 
527
 */
 
528
static inline void
 
529
kmem_cache_set_allocflags(spl_kmem_cache_t *skc, gfp_t flags)
 
530
{
 
531
        if (skc->skc_linux_cache == NULL)
 
532
                return;
 
533
 
 
534
#if defined(HAVE_KMEM_CACHE_ALLOCFLAGS)
 
535
        skc->skc_linux_cache->allocflags |= flags;
 
536
#elif defined(HAVE_KMEM_CACHE_GFPFLAGS)
 
537
        skc->skc_linux_cache->gfpflags |= flags;
 
538
#endif
 
539
}
 
540
 
516
541
#endif  /* _SPL_KMEM_H */