6. Given the inequality $\left|a x^{2}+b x+a\right| \leqslant x$ holds for $x \in$ $[1,2]$. Then the maximum value of $3 a+b$ is $\qquad$
6. 3 .

From the problem, we know that $\left|a\left(x+\frac{1}{x}\right)+b\right| \leqslant 1$.
Given $x \in[1,2]$, we have $t=x+\frac{1}{x} \in\left[2, \frac{5}{2}\right]$.
Thus, $|2 a+b| \leqslant 1$, and $\left|\frac{5}{2} a+b\right| \leqslant 1$.
Therefore, $3 a+b=2\left(\frac{5}{2} a+b\right)-(2 a+b) \leqslant 3$.
When $a=4, b=-9$, the equality holds.