Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142195
b: refs/heads/master
c: c3d06f9
h: refs/heads/master
i:
  142193: 7e1274e
  142191: 4c2a247
v: v3
  • Loading branch information
Andy Adamson authored and J. Bruce Fields committed Apr 4, 2009
1 parent 242ca54 commit b35f50b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 074fe897536f095309c5aaffcf912952882ab2cb
refs/heads/master: c3d06f9ce8544fecfe13e377d1e2c2e47fe18dbc
23 changes: 23 additions & 0 deletions trunk/fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/freezer.h>
#include <linux/fs_struct.h>
#include <linux/kthread.h>
#include <linux/swap.h>

#include <linux/sunrpc/types.h>
#include <linux/sunrpc/stats.h>
Expand Down Expand Up @@ -197,6 +198,26 @@ void nfsd_reset_versions(void)
}
}

/*
* Each session guarantees a negotiated per slot memory cache for replies
* which in turn consumes memory beyond the v2/v3/v4.0 server. A dedicated
* NFSv4.1 server might want to use more memory for a DRC than a machine
* with mutiple services.
*
* Impose a hard limit on the number of pages for the DRC which varies
* according to the machines free pages. This is of course only a default.
*
* For now this is a #defined shift which could be under admin control
* in the future.
*/
static void set_max_drc(void)
{
nfsd_serv->sv_drc_max_pages = nr_free_buffer_pages()
>> NFSD_DRC_SIZE_SHIFT;
nfsd_serv->sv_drc_pages_used = 0;
dprintk("%s svc_drc_max_pages %u\n", __func__,
nfsd_serv->sv_drc_max_pages);
}

int nfsd_create_serv(void)
{
Expand Down Expand Up @@ -229,6 +250,8 @@ int nfsd_create_serv(void)
nfsd_last_thread, nfsd, THIS_MODULE);
if (nfsd_serv == NULL)
err = -ENOMEM;
else
set_max_drc();

do_gettimeofday(&nfssvc_boot); /* record boot time */
return err;
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/linux/nfsd/nfsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ extern struct timeval nfssvc_boot;
#define NFSD_LEASE_TIME (nfs4_lease_time())
#define NFSD_LAUNDROMAT_MINTIMEOUT 10 /* seconds */

/* The percent of nr_free_buffer_pages used by the V4.1 server DRC */
#define NFSD_DRC_SIZE_SHIFT 7

/*
* The following attributes are currently not supported by the NFSv4 server:
* ARCHIVE (deprecated anyway)
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/sunrpc/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ struct svc_serv {
struct module * sv_module; /* optional module to count when
* adding threads */
svc_thread_fn sv_function; /* main function for threads */
unsigned int sv_drc_max_pages; /* Total pages for DRC */
unsigned int sv_drc_pages_used;/* DRC pages used */
};

/*
Expand Down

0 comments on commit b35f50b

Please sign in to comment.