~ubuntu-branches/ubuntu/saucy/slurm-llnl/saucy

« back to all changes in this revision

Viewing changes to src/slurmctld/ping_nodes.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2008-12-03 11:56:28 UTC
  • mfrom: (1.1.8 upstream) (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20081203115628-93t417da6wkazmo5
Tags: 1.3.11-1
New upstream release 

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
/* Request that nodes re-register at most every MAX_REG_FREQUENCY pings */
60
60
#define MAX_REG_FREQUENCY 20
61
61
 
62
 
/* Spawn no more than MAX_REG_THREADS for node re-registration */
63
 
#define MAX_REG_THREADS   DEFAULT_TREE_WIDTH
64
 
 
65
62
static pthread_mutex_t lock_mutex = PTHREAD_MUTEX_INITIALIZER;
66
63
static int ping_count = 0;
67
64
 
120
117
void ping_nodes (void)
121
118
{
122
119
        static int offset = 0;  /* mutex via node table write lock on entry */
 
120
        static int max_reg_threads = 0; /* max node registration threads
 
121
                                         * this can include DOWN nodes, so 
 
122
                                         * limit the number to avoid huge
 
123
                                         * communication delays */
123
124
        int i;
124
125
        time_t now, still_live_time, node_dead_time;
125
126
        static time_t last_ping_time = (time_t) 0;
161
162
        still_live_time = now - (slurmctld_conf.slurmd_timeout / 3);
162
163
        last_ping_time  = now;
163
164
 
164
 
        offset += MAX_REG_THREADS;
 
165
        if (max_reg_threads == 0) {
 
166
                max_reg_threads = MAX(slurm_get_tree_width(), 1);
 
167
        }
 
168
        offset += max_reg_threads;
165
169
        if ((offset > node_record_count) && 
166
 
            (offset >= (MAX_REG_THREADS * MAX_REG_FREQUENCY)))
 
170
            (offset >= (max_reg_threads * MAX_REG_FREQUENCY)))
167
171
                offset = 0;
168
172
 
169
173
        for (i = 0; i < node_record_count; i++) {
210
214
                 * once in a while). We limit these requests since they 
211
215
                 * can generate a flood of incomming RPCs. */
212
216
                if ((base_state == NODE_STATE_UNKNOWN) || restart_flag ||
213
 
                    ((i >= offset) && (i < (offset + MAX_REG_THREADS)))) {
 
217
                    ((i >= offset) && (i < (offset + max_reg_threads)))) {
214
218
                        hostlist_push(reg_agent_args->hostlist, 
215
219
                                      node_ptr->name);
216
220
                        reg_agent_args->node_count++;