If your engine even has a problem carboning up, you don't clear it at cold start. Nor do you clear it by spinning the engine to redline. "Revving" isn't meaningful to diesel engine performance the way it is to sport gas engines and it doesn't help remove carbon. It's just a rationalization.
To remove carbon, you want the engine working hard for 10-20 seconds. Rack position (think: throttle position) is what is relevant, not RPMs. Do it at normal and sane cruise RPMs, where RPMs are enough for the oiling system to be working well, since you will be putting max load on bearings which float in oil. Idle is the wrong speed for this but high revs is also wrong, since the fire won't be in the cylinder long enough.
I do it on the freeway in top gear, and just go to wide open throttle and hold it until unable/unsafe/illegal to continue. A good place (remember engine must be fully at operating temperature) is one of those curvy entrance ramps where you must accelerate from 30 mph to freeway speed. Start that in the highest gear you can without the engine lugging, and move the gears upward as needed to keep RPM in cruise range and acceleration poor. Poor acceleration equals longer time accelerating, which is what we want to maintain full rack for as long as possible.
Obviously lift off the throttle before you press the clutch to shift. I am assuming stick, if automatic you will find the auto downshifts to help you accelerate harder which is not what you want, and you will find it difficult to keep the RPMs low enough for this to work properly. With an automatic, your better choice is a nice steep mountain grade that demands the engine's all.
We have the same problem in locomotives: the electric transmission is infinitely variable so it's hard to hold full rack in any but maximum power (also max RPM). Fortunately locomotive diesels are built so the published redline (~1000 RPM) is analogous to an automobile's cruise, and they can run there for weeks, i.e. In stationary generator applications. So a nice grade does the trick just fine, and "nice grade" for a RR is is 1 or 2 feet rise per 100' run, barely noticeable to anyone but bicyclists. Grades like that are all over.