Just to argue against my own original post, Hong Kong has 6,544 people/sq km. Contrary to popular belief there is a lot of green space - just google map to see what I mean. Multiply Earth land surface area by HK population density and you get about 975 billion people, which is near Pop C (only 3 times the current population of Earth off...).
HK is dependent on imported food. I can live with a Pop C world managing to feed everyone at high TL agriculture ("soylent green for tea again, dear").
HK is dependent on water piped in over the border from China proper. The Pop=C world needs a lot of desalination plants, or a major comet farming industry, or more likely both. If a person need 150 litres a day (England average), I reckon the city needs to provide about 0.01% of the volume of Earth's oceans in water for the citizens every day.
Trantor has 40 billion people at the start of Foundation so clearly either Asimov hadn't done his maths, or it's a smaller world to be as densely populated as he describes.
Niven's Ringworld talks about the problem of waste heat at high TLs - not CO2 global warming, but old fashioned thermodynamic waste heat. There is an issue that at higher TLs, energy intensity of people's lives will go up. I'm not physicist enough to work out how serious a problem that is. Then again, if we don't worry about heat on ships, why worry about it on worlds...