Keep sharp edges when using subdivision surface

How can I use the subdivision surface modifier to create more high poly meshes without ruining sharp edges?
For example this mesh The sphere should be subdivided but the rim of the cylinder should...

Actions
Flag