In general relativity, nonnegative scalar curvature always gives some obstructions to the quasi-local mass of the boundary for compact manifolds. In this talk, we will give some intrinsic restrictions for the constant mean curvature hypersursurface that bounds a 3-dimensional or 4--dimensional compact manifold with nonnegative scalar curvature. We will discuss the condition to guarantee the positivity of its Hawking mass. We also establish some estimates of the Bartnik mass of such hypersurface. This is a joint work with Pengzi Miao and Naqing Xie.