They did it by slaughtering anyone and everyone who looked like a guerrilla; men, women, children, civilians. (The official version was that they were "relocated" but that's much like Jews being relocated by the Germans.) Even then, the Malayan communist movement wasn't extinguished until 1989...