For my assignment I need to determine suitable design patterns for my kernel module. Since it modifies one critical area of kernel code, I can't allow there to be more than one instance of it running - the modified code could be taken for the original and there'd be no way to restore the system to its initial state on module_exit. With that in mind, I chose the Singleton design pattern, among others. Now I need to actually implement the restriction, which goes along with it - the program needs to guarantee that only one instance of it is active at the time.
Is this common practice for kernel modules? I haven't seen this being discussed. If so, how can I implement the restriction?