I use this method to determine whether paying down the mortgage or not.
Let's say the mortgage rate is 4% for 30 years. The question is whether you can make more than 4% annual return on your investment. If the answer is YES, then don't pay down your mortgage.
Let's say your investment return is 6%, then 4% goes to the mortgage and you have 2% gain after that. Actually, your mortgage rate could be lower if you have itemized your tax return, so your effective mortgage rate could be around 3%. With current inflation rate around 2%, you are paying the mortgage with the depreciated dollar.
At today's economy and market condition, I will not pay down the mortgage since I can make more in the market.
I could think of one scenario that I will say to pay down your primary residence's mortgage.
If you have rental properties and they generate steady rental income gain year over year, then you might want to think about using the equity in your rental properties to upgrade your primary residence or pay down the mortgage on your primary residence. This way, your rental gain will be lower or gone, so does the tax。 In the meantime, you are cumulating more equity in your primary residence. In the future, if you can use the money to buy more rental properties, you can do a cash-out refinance on your primary residence with a better rate. If you use the money to upgrade your primary residence, that will increase the value of the property, the current tax code treats your primary residence gain favorably upon selling the property.
Remember, never use your equity in primary residence or rental properties to gamble in the stock market since you are trading your low risk money to put into high risk market.