The 49ers said the surgery, considered minor and done about a week ago, was performed by Dr. Tim McAdams and Dr. Gary Fanton at Stanford Hospitals and Clinics in nearby Redwood City.
Spokesman Bob Lange said there is no infection and no structural damage. The team will not put a timetable on Willis' return, but he isn't expected to be sidelined for long. The team will adjust his offseason conditioning and regimen as he rehabilitates.
The team also signed free agent cornerback Karl Paymah to a one-year deal.
Paymah, a third-round draft pick by Denver out of Washington State in 2005, is set to enter his sixth NFL season after largely playing on special teams so far. He has started seven of his 72 NFL games, recording 67 tackles, three interceptions, two fumble recoveries and one forced fumble.
The 27-year-old Paymah spent his first four seasons with the Broncos before signing with Minnesota in 2009.
That news follows this week's earlier headline involving quarterbacks.
The San Francisco 49ers signed free agent quarterback David Carr Monday to a two-year deal Monday and agreed to terms with Detroit on a trade that would send backup quarterback Shaun Hill to the Lions for a 2011 draft pick.
Carr said he found San Francisco attractive since he is from California and there was a possibility of playing time after serving as Eli Manning's backup for the New York Giants the past two seasons.
49ers coach Mike Singletary has repeatedly said 2005 No. 1 pick Alex Smith is the starter, but didn't rule out signing an experienced quarterback who could push Smith and challenge for playing time.
"They have said that competition is what they love around here," Carr said. "It makes you feel better. One of Singletary's things is, 'Iron sharpens iron.' The thing that I wanted to hear, from all those guys, was I'll have a chance to be on the field if I play the way I know I can play and they said yes. Once I get on the field, I feel confident that we are going to play well."
Carr, an eight-year NFL veteran, was drafted No. 1 overall by the Houston Texans in 2002. He played right away for the expansion team and was sacked 76 times as a rookie.