Less than one day into the iOS4 official release, and it's already possible to jailbreak your iPhone 3G or second-gen iPod Touch with redsn0w.
The Dev Team has already put out redsn0w version 0.9.5b5-3 (available for OS X and Windows here). The limitation right now is that you cannot yet jb the 3GS. Sorry, 3Gs owners. At least for now you still get multitasking without a jailbreak, so not all is bad. Besides, if you do run jailbreaks, chances are you haven't updated to iOS4 yet anyway.
Jailbreaking your phone is pretty straightforward. iSmashphone has a guide to jb. The procedure is the same, the only difference is the file version.
As always, don't forget to back up your device. That is probably the single most important step. You can always try to reinstall software, but you can't replace valuable data once it's gone.