6. Each cell of a $2011 \times 2011$ grid is labeled with an integer from $1,2, \cdots, 2011^{2}$, such that each number is used exactly once. Now, the left and right boundaries, as well as the top and bottom boundaries of the grid, are considered the same, forming a torus (which can be viewed as the surface of a "doughnut"). Find the largest positive integer $M$ such that for any labeling method, there exist two adjacent cells (cells sharing a common edge) whose numbers differ (the larger minus the smaller) by at least $M$.

【Note】Using coordinates, a cell $(x, y)$ and $\left(x^{\prime}, y^{\prime}\right)$ are adjacent if:
$$
\begin{aligned}
x=x^{\prime}, y-y^{\prime} \equiv \pm 1(\bmod 2011) \\
\text { or } \quad y=y^{\prime}, x-x^{\prime} \equiv \pm 1(\bmod 2011) .
\end{aligned}
$$
6. Let $N=2011$.

Consider a general $N \times N$ table.
When $N=2$, the conclusion is obvious, and the required $M=2$. An example is shown in Table 1.
Table 1
\begin{tabular}{|l|l|}
\hline 1 & 2 \\
\hline 3 & 4 \\
\hline
\end{tabular}

When $N \geqslant 3$, first prove:
$M \geqslant 2 N-1$.
Starting from a state where each small square in the table is white, write the numbers $1,2, \cdots$ in the table while coloring the marked squares black. Stop the operation when the following condition is first met: every row or every column has at least two black squares. Let the last number written be $k$.

Before marking $k$, there must be one row and one column with at most one black square.

Assume, when marking $k$, every row has two black squares. At this point, there is at most one row with all black squares. This is because if there are two rows with all black squares, then if $k$ is marked in one of these two rows, each row already had two black squares before (using $N \geqslant 3$); if $k$ is marked in another row, then each column already had two black squares.

Color a black square red if it has an adjacent white square. Since, except for the possible all-black row, each row has two black squares and one white square, each of these rows has at least two red squares. Furthermore, the row adjacent to the possible all-black row must have at least one white square. Therefore, at least one black square in the all-black row is colored red. Thus, the number of red squares is at least $2(N-1)+1=2 N-1$.

Therefore, the smallest number in all red squares is at most $k+1-(2 N-1)$.

When the adjacent white square of this red square is marked (the number marked is at least $k+1$), the difference between these two adjacent squares is at least $2 N-1$.

Since $N=2011$, it is sufficient to construct an example for $N=2 n+1(\geqslant 2)$.
Table 2 provides an example where $M=2 N-1$.
Therefore, the required $M=4021$.
Table 2
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline$(2 n+1)^{2}-2$ & $(2 n+1)^{2}-9$ & $\cdots$ & $\cdots$ & $n(2 n-1)+1$ & $\cdots$ & $\cdots$ & $(2 n+1)^{2}-10$ & $(2 n+1)^{2}-3$ \\
\hline$(2 n+1)^{2}-8$ & $\cdots$ & $\cdots$ & $n(2 n-1)+2$ & $\cdots$ & $n(2 n-1)$ & $\cdots$ & $\cdots$ & $(2 n+1)^{2}-11$ \\
\hline$\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\vdots$ \\
\hline$\cdots$ & $2 n^{2}$ & $\cdots$ & 8 & 2 & 6 & $\cdots$ & $2 n(n-1)+2$ & $2 n(n+1)+2$ \\
\hline $2 n^{2}+1$ & $\cdots$ & $\cdots$ & 3 & 1 & 5 & $\cdots$ & $\cdots$ & $2 n(n+1)+1$ \\
\hline$\cdots$ & $2 n^{2}+2$ & $\cdots$ & 10 & 4 & 12 & $\cdots$ & $2 n(n+1)$ & $\cdots$ \\
\hline$\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\vdots$ \\
\hline$(2 n+1)^{2}-7$ & $\cdots$ & $\cdots$ & $n(2 n+1)$ & $\cdots$ & $n(2 n+1)+2$ & $\cdots$ & $\cdots$ & $(2 n+1)^{2}-4$ \\
\hline$(2 n+1)^{2}-1$ & $(2 n+1)^{2}-6$ & $\cdots$ & $\cdots$ & $n(2 n+1)+1$ & $\cdots$ & $\cdots$ & $(2 n+1)^{2}-5$ & $(2 n+1)^{2}$ \\
\hline
\end{tabular}