Is there the longest geodesic? Given a closed 2-surface $M$ together with a Riemannian metric $g$.
We pick a free homotopy class $\gamma \in \pi_1(M)$ and consider the set $C(\gamma)$ of all closed geodesics homotopic to $\gamma$.
Of course, the set $C(\gamma)$ may be infinite. The length of a geodesic loop gives a function on $C(\gamma)$. My question is whether this function is bounded (in terms of $g$)?
 A: No such bound $C(\gamma)$ exists, even when $S$ is the two-sphere and even assuming that all geodesics considered are simple.  Here is the example (which generalises to surfaces with genus).
Suppose that $S$ is the two-sphere.  Pick four open disks $(D_i)_{i = 1}^4$ whose closures are closed disks and which are pairwise disjoint. (For example, use small round disks with respect to the usual round metric on $S$.)  Let $P = S - \bigcup_i D_i$; so $P$ is a "four-holed sphere".  We equip $P$ with a hyperbolic metric $g_P$ where all boundary components are geodesic.  We now claim the following:

*

*$(P, g_P)$ has infinitely many closed simple geodesics (produced, for example, by a "braiding" construction).

*All but four of these (namely, the curves of $\partial P$) are disjoint from $\partial P$.

*In any infinite collection of these geodesics, their lengths are unbounded.

We now choose any riemannian metric $g_S$ on $S$ that extends $g_P$.  Note that all of the previous geodesics (except perhaps the components of $\partial P$) remain geodesic with respect to the metric $g_S$.  Since all of those geodesics are null-homotopic in $S$, we are done.
Morally: The riemannian surface $(S, g_S)$ has four "mushrooms" (the disks $D_i$).  The geodesics used above wander around the surface avoiding the tops of the mushrooms.
A: This seems relevant to your question.
An isosceles tetrahedron (all four faces congruent)
contains arbitrarily long closed simple geodesics.
This paper proves the reverse: having such geodesics implies the surface is
an isosceles tetrahedron.

Akopyan, Arseniy, and Anton Petrunin. "Long geodesics on convex surfaces."  arXiv:1702.05172 (2017).

The authors say that their theorem "implies that a smooth convex surface does
not have arbitrarily long simple closed geodesics."

     
     Figure from Akopyan-Petrunin.
A: It is more reasonable to consider the situation when the genus of $M$ is finite, because when genus of $M$ is not finite, we can use some rescaling to expand some part of $M$ and the problem will be less meaningful.
In the compact situation, given $(M,g)$, $M$ is torus or sphere, then $C(\gamma)$ is bounded.
This is easy to prove, follow a topology argument and local regularity of geodesic flow, in fact this thing describle in the graph1 can not happen.
For a general compact manifold $M$, genus of $M$ is great than 1, first it is easy to prove there is a metric $g$ on $M$ with constant -1 sectional curvature. So by prime geodesic theorem, $\sup_{\gamma \in H_1(M)}C(\gamma)=\infty$, but there is no contradiction with for general $M,g$ and a fix $\gamma\in H_1(M)$, $C(\gamma)<\infty$, in fact this also follow from the phnomenon of graph1 can not happen(regularity of the ODE describle geodesic flow)

graph1
For noncompact case, I think following claim could be proved, but I do not guarantee that the following argument is completely correct
Claim
Given a orientable closed 2 -surface together with a Riemannian metric $(M,g
)$, and genus of $M$ is $n$. If we can give a condition on $g$ to make the following situation do not happen, We pick a cycle $\gamma \in H_{1}(M)$, and define,
$$C(\gamma)=\sup_{[c] = \ [\gamma]\in H_1(M)\\ c\ is\ closed\ geodesic}l(c)$$
where $l$ is the  length function, then $C(\gamma)$ is finite for all $\gamma\in H_1(M)$.
As a comment, $(M,g)$ with variable pointwise negative curvature can not avoid the situation.
situation

proof
a fix closed 2 -surface together with a Riemannian metric $(M,g
)$ with genus $n$. Such famalliy could be clssification into $n+1$ finer types, to define a type, we need first claim there is a cononical basis in $H_1(M)$ given by $\gamma_1,...,\gamma_n$, for each $\gamma_i$ it is a loop around a hole given in the second picture. And there are two type for "hole", one type is compact "hole", which is defined by the hole can not be eliminate by glue a $D$ to $M$, and the other type is noncompact "hole", which could be eliminate by glue a $D$ to $M$.
And a finer type of $(M,g)$ with genus $n$ is just counting the number of compact holes, there is at most $k$ and at least $0$ compact hole, so there is $k+1$ finer type. For each type there is $k$ compact genus and $n-k$ non-compact genus, $0\leq k\leq n$.
Now assume $(M,g)$ with genus $n$ also has type $k$, i.e. there is $k$ compact holes in $M$, and $n-k$ noncompact holes in $M$, assume the generators in $H_1(M)$ is $\{\gamma^c_1,...,\gamma^c_k,\gamma^{nc}_1,...,\gamma^{nc}_{n-k}\}$
for a general cycle $\gamma$ in $H_1(M)$ could be represent by $\gamma=\sum_{i=1}^ka_i\gamma^c_i+\sum_{i=1}^{n-k}b_i\gamma^{nc}_i$, it could be prove that,
$$C(\gamma)\lesssim \sum_{i=1}^ka_iC(\gamma^c_i)+\sum_{i=1}^{n-k}b_iC(\gamma^{nc}_i)$$
the constant in the previous inequality only depend on $(M,g)$.
So we only need to prove
$$C(\gamma^c_i)<\infty, C(\gamma^{nc}_i)<\infty, C([0])<\infty.$$
And if the metric $g$ is choosed such that the situation describle in the picture do not happen, and for example if contract $C([0])=\infty$, then there is a sequence of closed geodesic $w_1,w_2,...,w_n,...$ homotopic to zero and $l(w_1)<l(w_2)<l(w_3)<...<l(w_n)<..., \lim_{k\to \infty}l(w_k)=\infty$, on the other hand fix a compact subset of $M, M_k\subset M$ we can consider a family of covering $A_i, \cup_{a \in A_i}B_{r_i}(a)=M_k, \lim_{i\to \infty}r_i=0$, then for every scale $A_i$, there is a $B_{r_i}(a_i)$ s.t. $\limsup_jl((w_j)\cap B_{r_i}(a_i))=\infty$, and because geodesic flow is a hamiltonian system in $M\times TM$， so if we give some gerularity on $g$ then locally we can gain a uniformly upper bound on $l((w_j)\cap B_{r_i}(a_i))$, this derive the major part of $l(w_k)$ for $k$ suffice large is come fram place out of any compact set of $M$. So if $C([\gamma])$ is not bounded it must follow there is a infinite sequence of closed geodesic around a fix noncompact hole, which fall into the situation.
