Wireless networked control system is gaining momentum in industrial cyber-physical systems, e.g., smart factory. Suffering from limited bandwidth and nondeterministic link quality, a critical challenge in its deployment is how to optimize the closed-loop control system performance as well as maintain stability. In order to bridge the gap between network design and control system performance, we propose an optimal dynamic scheduling strategy that optimizes performance of multi-loop control systems by allocating network resources based on predictions of both link quality and control performance at run-time. The optimal dynamic scheduling strategy boils down to solving a nonlinear integer programming problem, which is further relaxed to a linear programming problem. The proposed strategy provably renders the closed-loop system meansquare stable under mild assumptions. Its efficacy is demonstrated by simulating a four-loop control system over an IEEE 802.15.4 wireless network simulator – TOSSIM. Simulation results show that the optimal dynamic scheduling can enhance control system performance and adapt to both constant and variable network background noises as well as physical disturbance.