DMX decided to be proactive in his battle with addiction before it led to another relapse -- and potentially more legal trouble -- so that's why he's back in rehab.
Sources close to the rapper tell TMZ ... one of X's kids is very sick -- in and out of the hospital -- and the stress of that coupled with the pressure of performing again made him feel tempted to use.
We're told X knew he needed help trying to balance his home and work life without the use of drugs, so he preemptively checked himself into rehab -- hoping to learn how to deal with his issues moving forward.
Our sources say he knows a relapse could jeopardize his freedom, and wants to stay out of jail so he can support his family and friends -- while still performing for his fans.
DMX is on probation and gets tested randomly for drugs and alcohol ... so another failed test could result in him back behind bars.
Waiting for your permission to load the Instagram Media.
As we reported ... the rapper canceled a couple of gigs this weekend after announcing he checked himself into a rehab facility, and was putting his family and his sobriety first.
DMX has struggled with addiction for many years and has been jailed numerous times for drug-related offenses, and has been in and out of rehab.