Skip to content

Commit 111099c

Browse files
committed
BF: CS-676: Improve qmaster shutdown performance for scenarios where the master has more that 128 threads
1 parent 638c8b4 commit 111099c

File tree

3 files changed

+10
-27
lines changed

3 files changed

+10
-27
lines changed

source/daemons/qmaster/sge_c_gdi.cc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,23 +269,17 @@ sge_c_gdi_process_in_listener(sge_gdi_packet_class_t *packet, sge_gdi_task_class
269269
sge_pack_buffer *pb = &(packet->pb);
270270
switch (operation) {
271271
case SGE_GDI_TRIGGER:
272-
#if 0
273-
MONITOR_GDI_TRIG(monitor);
274-
#endif
272+
MONITOR_LIS_GDI_TRIG(monitor);
275273
sge_c_gdi_trigger_in_listener(packet, task, monitor);
276274
sge_gdi_packet_pack_task(packet, task, answer_list, pb);
277275
DRETURN(true);
278276
case SGE_GDI_PERMCHECK:
279-
#if 0
280-
MONITOR_GDI_PERM(monitor);
281-
#endif
277+
MONITOR_LIS_GDI_PERM(monitor);
282278
sge_c_gdi_permcheck(packet, task, monitor);
283279
sge_gdi_packet_pack_task(packet, task, answer_list, pb);
284280
DRETURN(true);
285281
case SGE_GDI_GET:
286-
#if 0
287-
MONITOR_GDI_GET(monitor);
288-
#endif
282+
MONITOR_LIS_GDI_GET(monitor);
289283
sge_c_gdi_get_in_listener(ao, packet, task, monitor);
290284
sge_gdi_packet_pack_task(packet, task, answer_list, pb);
291285
DRETURN(true);

source/daemons/qmaster/sge_thread_reader.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ sge_reader_main(void *arg) {
233233
sge_c_report(packet->host, packet->commproc, packet->commproc_id, task->data_list, p_monitor);
234234
} else if (packet->request_type == PACKET_ACK_REQUEST) {
235235
task = packet->first_task;
236+
// @TODO: This could be done by listener already?
236237
sge_c_ack(packet, task, p_monitor);
237238
} else {
238239
DPRINTF("unknown request type %d\n", packet->request_type);

source/daemons/qmaster/sge_thread_worker.cc

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ sge_worker_main(void *arg) {
218218
MONITOR_SET_QLEN(p_monitor, sge_tq_get_task_count(GlobalRequestQueue));
219219

220220
// handle the packet only if it is not nullptr and the shutdown has not started
221-
if (packet != nullptr && !sge_thread_has_shutdown_started()) {
221+
if (packet != nullptr) {
222222
sge_gdi_task_class_t *task;
223223
bool is_only_read_request = true;
224224

@@ -352,23 +352,11 @@ sge_worker_main(void *arg) {
352352
sge_monitor_output(p_monitor);
353353
}
354354

355-
// pass the cancellation point at least once or stay here if shutdown was triggered
356-
bool shutdown_started = false;
357-
do {
358-
// pthread cancellation point
359-
int execute = 0;
360-
pthread_cleanup_push(sge_worker_cleanup_monitor, static_cast<void *>(p_monitor));
361-
cl_thread_func_testcancel(thread_config);
362-
pthread_cleanup_pop(execute); // cleanup monitor
363-
364-
// shutdown in process?
365-
shutdown_started = sge_thread_has_shutdown_started();
366-
367-
// if we will wait here than do not eat up all cpu time
368-
if (shutdown_started) {
369-
sge_usleep(25000);
370-
}
371-
} while (shutdown_started);
355+
// pthread cancellation point
356+
int execute = 0;
357+
pthread_cleanup_push(sge_worker_cleanup_monitor, static_cast<void *>(p_monitor));
358+
cl_thread_func_testcancel(thread_config);
359+
pthread_cleanup_pop(execute); // cleanup monitor
372360
}
373361

374362
// Don't add cleanup code here. It will never be executed. Instead, register a cleanup function with

0 commit comments

Comments
 (0)