Line 9b includes state, local, and foreign income taxes that you paid for the tax year that are attributable to net investment income, as opposed to wage income from Form W-2.
Net investment income generally includes gross income from interest, dividends, annuities, royalties, and rents. See Net investment income in the 2021 Instructions for Form 8960 for a more detailed explanation.
The general formula for Line 9b is net investment income divided by adjusted gross income, multiplied by your state, local and foreign taxes. However, the portion allocable to net investment income can be computed using any reasonable method. See Line 9b—State, Local, and Foreign Income Tax in the instructions linked above.