What if the smoke alarm goes off while I'm cooking?

Then it's doing its job. Do not disable your smoke alarm if it alarms due to cooking or other non-fire causes. You may not remember to put the batteries back in the alarm after cooking. Instead, clear the air by waving a towel near the alarm, leaving the batteries in place. The alarm may have to be moved to a new location.