There seem to be two very important things here:
An insult isn't necessarily ad hominem (Argumentum ad hominem). Something can be a personal attack while not being a logical fallacy.
It becomes a logical fallacy if it is being used to counter or devalue and argument though, since then you're trying to use it as an argument. This is very important, someone may just insult you, not wanting to counter your argument with it.
Case 1
If B is trying to dismiss an argument A made in the criticism by saying B is a troll, that is an ad hominem fallacy.
Case 2
It is ad hominem if Person B is trying to dismiss an argument Person A made by calling A a troll.
If they just state that they think A is a troll, while not trying to mean that as a counter-argument, then no, that would not be a fallacy.
If stating that A's opinion is not to be taken since he is a known troll, that is ad hominem, as it doesn't actually engage the argument A made, but rather attacks A as a person to devalue their argument.
Based on an interesting read I just had on that: http://laurencetennant.com/bonds/adhominem.html