Beispiel #1
0
void sptlrpc_enc_pool_fini(void)
{
        unsigned long cleaned, npools;

        LASSERT(pools_shrinker);
        LASSERT(page_pools.epp_pools);
        LASSERT(page_pools.epp_total_pages == page_pools.epp_free_pages);

        cfs_remove_shrinker(pools_shrinker);

        npools = npages_to_npools(page_pools.epp_total_pages);
        cleaned = enc_pools_cleanup(page_pools.epp_pools, npools);
        LASSERT(cleaned == page_pools.epp_total_pages);

        enc_pools_free();

        if (page_pools.epp_st_access > 0) {
                CWARN("max pages %lu, grows %u, grow fails %u, shrinks %u, "
                      "access %lu, missing %lu, max qlen %u, max wait "
                      CFS_TIME_T"/%d\n",
                      page_pools.epp_st_max_pages, page_pools.epp_st_grows,
                      page_pools.epp_st_grow_fails,
                      page_pools.epp_st_shrinks, page_pools.epp_st_access,
                      page_pools.epp_st_missings, page_pools.epp_st_max_wqlen,
                      page_pools.epp_st_max_wait, CFS_HZ);
        }
}
Beispiel #2
0
void sptlrpc_enc_pool_fini(void)
{
	unsigned long cleaned, npools;

	LASSERT(page_pools.epp_pools);
	LASSERT(page_pools.epp_total_pages == page_pools.epp_free_pages);

	unregister_shrinker(&pools_shrinker);

	npools = npages_to_npools(page_pools.epp_total_pages);
	cleaned = enc_pools_cleanup(page_pools.epp_pools, npools);
	LASSERT(cleaned == page_pools.epp_total_pages);

	enc_pools_free();

	if (page_pools.epp_st_access > 0) {
		CDEBUG(D_SEC,
		       "max pages %lu, grows %u, grow fails %u, shrinks %u, access %lu, missing %lu, max qlen %u, max wait %ld/%d\n",
		       page_pools.epp_st_max_pages, page_pools.epp_st_grows,
		       page_pools.epp_st_grow_fails,
		       page_pools.epp_st_shrinks, page_pools.epp_st_access,
		       page_pools.epp_st_missings, page_pools.epp_st_max_wqlen,
		       page_pools.epp_st_max_wait, HZ);
	}
}
Beispiel #3
0
void sptlrpc_enc_pool_fini(void)
{
        unsigned long cleaned, npools;

        LASSERT(pools_shrinker);
        LASSERT(page_pools.epp_pools);
        LASSERT(page_pools.epp_total_pages == page_pools.epp_free_pages);

	remove_shrinker(pools_shrinker);

        npools = npages_to_npools(page_pools.epp_total_pages);
        cleaned = enc_pools_cleanup(page_pools.epp_pools, npools);
        LASSERT(cleaned == page_pools.epp_total_pages);

        enc_pools_free();

	if (page_pools.epp_st_access > 0) {
		CDEBUG(D_SEC,
		       "max pages %lu, grows %u, grow fails %u, shrinks %u, "
		       "access %lu, missing %lu, max qlen %u, max wait "
		       CFS_TIME_T"/%lu\n",
		       page_pools.epp_st_max_pages, page_pools.epp_st_grows,
		       page_pools.epp_st_grow_fails,
		       page_pools.epp_st_shrinks, page_pools.epp_st_access,
		       page_pools.epp_st_missings, page_pools.epp_st_max_wqlen,
		       page_pools.epp_st_max_wait,
		       msecs_to_jiffies(MSEC_PER_SEC));
	}
}
Beispiel #4
0
static int enc_pools_add_pages(int npages)
{
        static CFS_DECLARE_MUTEX(sem_add_pages);
        cfs_page_t   ***pools;
        int             npools, alloced = 0;
        int             i, j, rc = -ENOMEM;

        if (npages < PTLRPC_MAX_BRW_PAGES)
                npages = PTLRPC_MAX_BRW_PAGES;

        cfs_down(&sem_add_pages);

        if (npages + page_pools.epp_total_pages > page_pools.epp_max_pages)
                npages = page_pools.epp_max_pages - page_pools.epp_total_pages;
        LASSERT(npages > 0);

        page_pools.epp_st_grows++;

        npools = npages_to_npools(npages);
        OBD_ALLOC(pools, npools * sizeof(*pools));
        if (pools == NULL)
                goto out;

        for (i = 0; i < npools; i++) {
                OBD_ALLOC(pools[i], CFS_PAGE_SIZE);
                if (pools[i] == NULL)
                        goto out_pools;

                for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) {
                        pools[i][j] = cfs_alloc_page(CFS_ALLOC_IO |
                                                     CFS_ALLOC_HIGH);
                        if (pools[i][j] == NULL)
                                goto out_pools;

                        alloced++;
                }
        }
        LASSERT(alloced == npages);

        enc_pools_insert(pools, npools, npages);
        CDEBUG(D_SEC, "added %d pages into pools\n", npages);
        rc = 0;

out_pools:
        enc_pools_cleanup(pools, npools);
        OBD_FREE(pools, npools * sizeof(*pools));
out:
        if (rc) {
                page_pools.epp_st_grow_fails++;
                CERROR("Failed to allocate %d enc pages\n", npages);
        }

        cfs_up(&sem_add_pages);
        return rc;
}
Beispiel #5
0
static int enc_pools_add_pages(int npages)
{
    static DEFINE_MUTEX(add_pages_mutex);
    struct page   ***pools;
    int	     npools, alloced = 0;
    int	     i, j, rc = -ENOMEM;

    if (npages < PTLRPC_MAX_BRW_PAGES)
        npages = PTLRPC_MAX_BRW_PAGES;

    mutex_lock(&add_pages_mutex);

    if (npages + page_pools.epp_total_pages > page_pools.epp_max_pages)
        npages = page_pools.epp_max_pages - page_pools.epp_total_pages;
    LASSERT(npages > 0);

    page_pools.epp_st_grows++;

    npools = npages_to_npools(npages);
    OBD_ALLOC(pools, npools * sizeof(*pools));
    if (pools == NULL)
        goto out;

    for (i = 0; i < npools; i++) {
        OBD_ALLOC(pools[i], PAGE_CACHE_SIZE);
        if (pools[i] == NULL)
            goto out_pools;

        for (j = 0; j < PAGES_PER_POOL && alloced < npages; j++) {
            pools[i][j] = alloc_page(GFP_NOFS |
                                     __GFP_HIGHMEM);
            if (pools[i][j] == NULL)
                goto out_pools;

            alloced++;
        }
    }
    LASSERT(alloced == npages);

    enc_pools_insert(pools, npools, npages);
    CDEBUG(D_SEC, "added %d pages into pools\n", npages);
    rc = 0;

out_pools:
    enc_pools_cleanup(pools, npools);
    OBD_FREE(pools, npools * sizeof(*pools));
out:
    if (rc) {
        page_pools.epp_st_grow_fails++;
        CERROR("Failed to allocate %d enc pages\n", npages);
    }

    mutex_unlock(&add_pages_mutex);
    return rc;
}