But you see, he performed the inception on Mal once he discovered her secret in the safe, which was the spinning top. So once he realized he was in her dream, he convinced Mal to come back to reality because nothing was real, however, Mal never grasped their "reality", thus commiting suicide to go back to her own perception of what reality was (for her anyway).
The majority consensus seems to lead us to believe that the whole thing was a dream. Some people (myself) think it was Cobb's dream the whole time and in the end he remains dreaming, others believe that Cobb was merely a character in someone else's dream in which he himself may have been the subject of the inception the whole time.
The last scene just wraps everything up and leaves you guessing.