The polysilicon thin film piezoresistors are widely used in semiconductor pressure sensors. The polysilicon thin film has good piezoresistance properties, which are determined by the grain structure and doping concentration. The gauge factor of the polysilicon thin film is usually modified according to the relationship between gauge factor and doping concentration. The polysilicon thin films are classified into common polysilicon thin films and polysilicon nanofilms according to their thickness. The common polysilicon thin film thickness is more than 0.3 μm, which has good temperature characteristic, but its piezoresistance coefficient is small. However, the polysilicon nanofilm thickness is less than 0.1 μm, which has good temperature characteristic and high piezoresistance coefficient. The existing piezoresistance theory of the common polysilicon thin film cannot explain reasonably the experimental result of polysilicon nanofilm piezoresistance. Therefore, the tunneling piezoresistance model and an algorithm for the p-type polysilicon nanofilm piezoresistance coefficient were established in 2006. However, this algorithm presents an incomplete fundamental piezoresistance coefficient. In order to improve the polysilicon thin film piezoresistance theory, based on the tunneling piezoresistance model and the mechanism of silicon and the valence band hole conductivity mass with the change of stress, a novel algorithm for the piezoresistance coefficient of the p-type polysilicon thin film is presented. The theoretical formulas for three fundamental piezoresistance coefficients π11, π12 and π44 of the grain neutral and grain boundary regions, are presented respectively. With these formulas for the coefficients, the longitudinal and transverse piezoresistance coefficients for arbitrary crystal direction texture polysilicon can be obtained. According to the structure characteristics, the gauge factors of the p-type polysilicon nanofilm and the common polysilicon thin film are calculated, and then the longitudinal and transverse gauge factors are plotted each as a function of doping concentration, which are compared with the experimental results. According to the experimental results of the polysilicon nanofilm, the grain size is L=30 nm, the grain crystal directions are randomly distributed. The trap density in grain boundary region is Nt=1013 cm-2, the Young's modulus of elastic diaphragm is Y=1.69×1011 Pa, the Poisson ratio of elastic diaphragm is ν=0.062, the grain boundary width is δ=1 nm, and the thickness is 80 nm. The comparison indicates that the gauge factor average error between calculation and experiment is 0.5 times less than the average experimental difference between the maximum and the minimum for each doping concentration. For the common polysilicon thin film, according to the experimental results, its grain size L is 135 nm, thickness is 400 nm, the orientations of crystal grain neutral region are[311],[111] and[110] in the ratio of 49:31:20, i.e., 〈311〉:〈111〉:〈110〉=49:31:20, and the gauge factor calculated result is also good agreement with the experimental result. Therefore, the proposed algorithm is comprehensive and accurate, which is applicable to the p-type common polysilicon film and the polysilicon nanofilm.