For the circumstances presented in the original post ... essentially crossing the yellow line in order to make it through a corner faster on the road ... it is (almost) NEVER ok to do that. If you find the need to do that, you are going too fast for your skill level.
A twisty road is more twisty and more challenging if you stay within your own lane ... Straightening it out just makes it look more like a straightaway, and what's the point of that?
And by staying within your own lane, try staying ENTIRELY in your own lane, including your upper body and head. With a motorcycle, it's quite possible to have your tire contact patches on the correct side of the center line and your entire body on the wrong side of it.
Emergency situations in which you spot something seriously traction-deficient in your own lane or some other such thing, are another matter, but even then it begs the question of whether you are going too fast for your skill level, or going too fast for your headlights.
The other circumstance is that of passing a slow vehicle on a straightaway. There's nothing in Ontario's HTA that says you can't do it, as long as you are not within a specified distance of a hill, bridge, intersection, etc. But ... It's bad practice. It's one thing if the slow vehicle is a farm tractor. If the other vehicle is a car that is within some reasonable factor of the speed limit then doing things like that gives US a bad name. It also creates bad habits if you happen to go somewhere else in the world where the law is different (which is practically everywhere).
Having said that, there are a good many cases where there is a kilometer or more of visibility, and it was a legal passing zone for years, and the municipality opted to re-paint it as double yellow. In cases like that, because it's not the law in Ontario, they can get stuffed. I'll pass where it's safe.