If you haven't "toothpasted" you mask, you need to do so. As someone said, any non-gel paste will work. There are just enough abrasives in it to clean the mask without scratching it. Dirty masks WILL fog, even if you use regular spit or one of the commercial products. I use toothpaste on my mask 2-3 times a year just to clean it, but I dive a lot (over 100 dives/year). Once a year would be adequate for most people.
Before your dive, apply your anti-fog product of choice. They all work, even the homemade products like diluted baby shampoo. Some work best if you apply them to a dry mask and let them dry. Others work better if put in a wet mask and rinse immediately. Play around with your defogging procedure and find the one that works best for you.
There is no reason to be swimming around with a mask that fogs because it is an easy problem to solve. Now if you're a student worried about your mask fogging in class, it won't be that way when you are actually diving. In class you are constantly taking your mask on and off, and that "washes" the defog it and will make your mask fog. That's just the way it is and you can't do much about it. But when actually diving, you shouldn't have that problem.