qsup.c File Reference

Implementation of the QoS Supervisor module. More...

#include "qres_config.h"
#include <linux/aquosa/qos_debug.h>
#include <linux/aquosa/qos_prof.h>
#include "qsup.h"
#include <linux/aquosa/qos_memory.h>
#include <linux/aquosa/qos_ul.h>

Go to the source code of this file.

Data Structures

struct  qsup_user_t
 QoS Sup related data for each user. More...
struct  qsup_level_t
 QoS Sup related data for each level. More...

Defines

#define QOS_DEBUG_LEVEL   QSUP_MOD_DEBUG_LEVEL
#define QSUP_COEFF_BITS   16
 Number of binary decimal digits in qsup_coeff_t.
#define QSUP_COEFF_ONE   (1ul << QSUP_COEFF_BITS)
 This corresponds to a qsup_coeff_t of 1.0.
#define coeff_apply(a, b)   ((unsigned long) ul_mul_shr((__u32) (a), (__u32) (b), QSUP_COEFF_BITS) )
 Scale (multiply) a bandwidth value by a coefficient.
#define coeff_compute(a, b)   ((unsigned long) ul_shl_div((__u32) (a), QSUP_COEFF_BITS, (__u32) (b)) )
 Compute a coefficient value as the equivalent operation on reals: a/b.
#define MAX_NUM_LEVELS   2

Typedefs

typedef long int qsup_coeff_t
 Bandwidth coefficients are stored as fixed-point integers.
typedef struct qsup_user_t qsup_user_t
 QoS Sup related data for each user.
typedef struct qsup_level_t qsup_level_t
 QoS Sup related data for each level.

Functions

static void qsup_lock_coeffs_read (unsigned long *p_flags)
 Global QSUP coefficients lock.
static void qsup_unlock_coeffs_read (unsigned long flags)
 Unlock QSup coefficients for reading.
static void qsup_lock_coeffs_write (unsigned long *p_flags)
 Lock QSup coefficients for writing.
static void qsup_unlock_coeffs_write (unsigned long flags)
 Unlock QSup coefficients for writing.
static qos_bw_t bw_min (qos_bw_t a, qos_bw_t b)
qos_rv qsup_add_level_rule (int level, qos_bw_t max_bw)
 Add a level rule to the QSUP.
qos_rv qsup_add_group_constraints (int gid, qsup_constraints_t *constr)
 Add a group rule to the QSUP.
qos_rv qsup_add_user_constraints (int uid, qsup_constraints_t *constr)
 Add a user rule to the QSUP.
qos_rv qsup_init ()
 Initialize the QSUP subsystem just after module load into the kernel.
qos_rv qsup_cleanup ()
 Cleanup the QSUP subsystem before unloading the module from kernel.
qsup_constraints_tqsup_find_constr (int uid, int gid)
 Find the constraints in force for the supplied uid/gid pair.
qsup_server_tqsup_find_server_by_id (int server_id)
 Return qsup_server_t structure for specified server_id, or zero if not found.
qos_rv get_user_info (qsup_user_t **pp, int uid)
 Retrieve a qsup_user_t structure for the specified uid.
qos_bw_t qsup_get_max_gua_bw (int uid, int gid)
 Returns the maximum guaranteed bandwidth for the specified user.
qos_rv qsup_get_avail_gua_bw (int uid, int gid, qos_bw_t *p_avail_bw)
 Returns in *p_avail_bw the available guaranteed bw for the specified user.
qos_rv qsup_get_avail_bw (int uid, int gid, qos_bw_t *p_avail_bw)
 Returns in *p_avail_bw the available bw for the specified user.
qos_rv qsup_init_server (qsup_server_t *srv, int uid, int gid, qres_params_t *param)
 Initialize a new qsup_server_t structure.
qos_rv qsup_create_server (qsup_server_t **pp, int uid, int gid, qres_params_t *param)
 Create a new qsup_server_t structure.
qos_rv qsup_cleanup_server (qsup_server_t *srv)
qos_rv qsup_destroy_server (qsup_server_t *srv)
 Destroy a qsup_server_t and free associated resources.
qos_rv qsup_set_required_bw (qsup_server_t *srv, qos_bw_t server_req)
 Sets the required bandwidth for the specified server.
qos_bw_t qsup_get_required_bw (qsup_server_t *srv)
 Gets the required bandwidth for the specified server.
qos_bw_t qsup_get_guaranteed_bw (qsup_server_t *srv)
 Gets the minimum granted bandwidth for the specified server.
void qsup_dump (void)
 Dumps into the log system the QSUP server complete state.
qos_bw_t qsup_get_approved_bw (qsup_server_t *srv)
 Returns the bandwidth approved for the specified server.
qos_rv qsup_reserve_spare (qos_bw_t bw)
 Cannot reserve more than U_LUB as spare, and cannot change the reserved spare when servers are already active.

Variables

qsup_group_rule_tgroup_rules = 0
int num_group_rules = 0
qsup_user_rule_tuser_rules = 0
int num_user_rules = 0
qos_bw_t spare_bw = 0
static qsup_constraints_t default_constraint
qsup_server_tqsup_servers
 Head of global list of created qsup_servers.
int next_server_id
 Id assigned to the next created qsup_server_t.
static qsup_user_tqsup_users
 User related data.
static qsup_level_t qsup_levels [MAX_NUM_LEVELS]
 Level related data.
static qos_bw_t tot_gua_bw = 0
 Sum of guaranteed bandwidths of accepted servers.
static qos_bw_t tot_used_gua_bw = 0
 Sum of actually used guaranteed bw by all servers.

Detailed Description

Implementation of the QoS Supervisor module.

Todo:

Add synchronization primitives.

After a while the QSUP goes on, the truncations in computations might lead to very bad things. A fix could be a periodic/sporadic recomputation of all values, including partials and totals.

All globals should be placed inside a structure, to be instantiated one time for each RR-enabled processor, for SMP systems.

Definition in file qsup.c.


Define Documentation

#define QOS_DEBUG_LEVEL   QSUP_MOD_DEBUG_LEVEL

Definition at line 2 of file qsup.c.

Generated on Mon Aug 2 22:39:17 2010 for qosres by  doxygen 1.6.3