Showing error 843

User: Jiri Slaby
Error type: Resource Leak
Error type description: The code omits to put the resource to the system for reuse
File location: drivers/misc/sgi-gru/grutlbpurge.c
Line in file: 81
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:40:13 UTC


Source:

 51 * the TGH. For offblade GRUs, select a random TGH in the range above the
 52 * private TGHs. A spinlock is required to access this TGH & the lock must be
 53 * released when the invalidate is completes. This sucks, but it is the best we
 54 * can do.
 55 *
 56 * Note that the spinlock is IN the TGH handle so locking does not involve
 57 * additional cache lines.
 58 *
 59 */
 60static inline int get_off_blade_tgh(struct gru_state *gru)
 61{
 62        int n;
 63
 64        n = GRU_NUM_TGH - gru->gs_tgh_first_remote;
 65        n = gru_random() % n;
 66        n += gru->gs_tgh_first_remote;
 67        return n;
 68}
 69
 70static inline int get_on_blade_tgh(struct gru_state *gru)
 71{
 72        return uv_blade_processor_id() >> gru->gs_tgh_local_shift;
 73}
 74
 75static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_state
 76                                                         *gru)
 77{
 78        struct gru_tlb_global_handle *tgh;
 79        int n;
 80
 81        preempt_disable();
 82        if (uv_numa_blade_id() == gru->gs_blade_id)
 83                n = get_on_blade_tgh(gru);
 84        else
 85                n = get_off_blade_tgh(gru);
 86        tgh = get_tgh_by_index(gru, n);
 87        lock_tgh_handle(tgh);
 88
 89        return tgh;
 90}
 91
Show full sources