Quick masking allows you to mask parts of your mesh you don't want to paint on.
- Hit Y to switch to quick mask edit mode, this will allow you to paint a temporary mask.
- Hit U again to switch back to your previous tool and paint across that mask.
- Hit Y to reset/disable the mask.
- Hit I to invert the mask while in quick mask edit mode.