From 2c9f5b130fd1c41251c480570da277dec72813e6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 16 Aug 2009 19:12:36 +0200 Subject: [PATCH] [MINOR] move the initial task's nice value to the listener Since the listener is the one indicating what analyser and session handlers to call, it makes sense that it also sets the task's nice value. This also helps getting rid of the last trace of the stats in the proto_uxst file. --- include/types/protocols.h | 3 ++- src/client.c | 3 ++- src/dumpstats.c | 1 + src/proto_uxst.c | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/types/protocols.h b/include/types/protocols.h index 0b4b7123a..9247ef16e 100644 --- a/include/types/protocols.h +++ b/include/types/protocols.h @@ -2,7 +2,7 @@ include/types/protocols.h This file defines the structures used by generic network protocols. - Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu + Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -90,6 +90,7 @@ struct listener { int *timeout; /* pointer to client-side timeout */ void *private; /* any private data which may be used by accept() */ unsigned int analysers; /* bitmap of required protocol analysers */ + int nice; /* nice value to assign to the instanciated tasks */ union { /* protocol-dependant access restrictions */ struct { /* UNIX socket permissions */ uid_t uid; /* -1 to leave unchanged */ diff --git a/src/client.c b/src/client.c index 93bd8946a..b2e7d782a 100644 --- a/src/client.c +++ b/src/client.c @@ -1,7 +1,7 @@ /* * Client-side variables and functions. * - * Copyright 2000-2008 Willy Tarreau + * Copyright 2000-2009 Willy Tarreau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -173,6 +173,7 @@ int event_accept(int fd) { t->process = l->handler; t->context = s; + t->nice = l->nice; s->task = t; s->listener = l; diff --git a/src/dumpstats.c b/src/dumpstats.c index 91c90e922..24aab0594 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -121,6 +121,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx global.stats_sock.accept = uxst_event_accept; global.stats_sock.handler = process_session; global.stats_sock.analysers = AN_REQ_STATS_SOCK; + global.stats_sock.nice = -64; /* we want to boost priority for local stats */ global.stats_sock.private = global.stats_fe; /* must point to the frontend */ global.stats_fe->timeout.client = MS_TO_TICKS(10000); /* default timeout of 10 seconds */ diff --git a/src/proto_uxst.c b/src/proto_uxst.c index 507836979..880ec993a 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -1,7 +1,7 @@ /* * UNIX SOCK_STREAM protocol layer (uxst) * - * Copyright 2000-2008 Willy Tarreau + * Copyright 2000-2009 Willy Tarreau * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -432,7 +432,7 @@ int uxst_event_accept(int fd) { t->process = l->handler; t->context = s; - t->nice = -64; /* we want to boost priority for local stats */ + t->nice = l->nice; s->task = t; s->listener = l;