There has been lots of speculations on why they did it, the official and un-official reasons.

What Exactly did they Contribute in those 20k lines?

Microsoft released the Hyper-V Linux Integration Components (LinuxIC) kernel drivers, that let Linux recognize and optimize for running on Microsoft’s Hyper-V virtualization platform, under the GNU General Public License, version 2. The code is currently part of Novell’s SUSE Linux 10 and RHEL 5.x; the GPL decision will make the code more widely available. The action was identified in Microsoft’s press release as “a break from the ordinary” and by some Linux partisans as a sign of imminent apocalyspse.

Sam Ramji, senior director of Platform Strategy at Microsoft:

“Many people are surprised when they hear how much open source community and development work is happening across Microsoft. This probably has a lot to do with the fact that we’re focused on getting the work done, and engaging with communities on a one-to-one basis, rather than promoting it.”

Microsoft’s Intentions and Mysteries

Different people will answer this differently. NetworkWorld says, Linux community had invited Microsoft for making this contribution. Though, most people still see it with an Eye of Suspicion.

The way I would interpret it would be: Isn’t this the best way historically to take down your enemy is to become their friend and to help them until you’ve got them where you want them? Remember the MAC vs. windows in Back old days when bill Gates partnered with Apple to contribute, and later partnership ended with Windows copying all the good GUI features of MACintosh OS. His strategy was to gain their trust and the trust of their friends, and then betray via several means by stealing, creating chaos and distrust between them. You keep them guessing at the truth. When everything is confused, you strike them where it hurts the most. (If you have seen the movie “Pirates of the Silicon Valley” you probably know what I’m talking about.)
Then again, Microsoft might just want to get out of the kernel business and rely on Linux in the future. Does that sound like Real to you?

This is all an embrace-and-extend plot to allow Hyper-V to feast on the blood of the open-source movement, that’s probably not where things are heading.

Kennedy makes the case that it happened to IBM and Novell, and it sure did – but you’d have to unearth that Microsoft to trigger than behavior. And a combination of antitrust avalanches and the quick silty accumulations of the open-source software movement have buried that casket… maybe not irretrievably deep, but deep enough.

May be they wanted to ruin Novell by opensourcing their proprietry code for Hyper-V support. It’s the revenge from the past.

Ouch, and maybe a little disingenuous, but far more believable coming out of Microsoft ’09 than it might have been from Microsoft ’99. Ten years ago Microsoft was feeling the brunt of US antitrust investigators; just a few years before, it had heaved itself into the Internet Age in one of the more impressive sea changes in recent business history. Even those who prefer sleeker, more agile organizations — the yacht that is Apple, Linux’s speedy cigarette-boat mentality – have to admit that turning around a barge like Microsoft circa 1994 takes some fancy navigation.

Not to mention some brutal lurching activity in the wheelhouse. Microsoft made their turnaround, in part, by doing the sort of things they’d done in the past to the likes of Big Blue IBM, only doing them to Netscape. But this time the Department of Justice didn’t turn its head, and the rest is history. Or not even history — as we speak, the European Union is still wrapping up antitrust proceedings against Redmond. It feels almost retro in the Google era.

But the code Microsoft contributed serves Microsoft’s purposes! It only makes Linux run faster on their Hyper-V!, some cry. Well, what would you expect? And what if it does? Many companies want to optimize for Linux these days. All of them must agree to and abide by the terms of the GPL. If the rules were applied to fairly to Microsoft as to other companies — and there’s no evidence to think they were not — there shouldn’t be a problem.

And of course Microsoft wants to own the virtualization space; unlike killing open source, that’s probably doable. It’s rather unlikely, though, that the broader plan is to somehow drain the life force out of the GPL and kill open source. (The recent kerfuffle over FAT patents alone ought to convince skeptics that there’s no overarching plan here; they’re chaotic in Redmond sometimes, but not like that.)

I’m far more inclined to suspect that frustration (either in-house, outside, or both) over Hyper-V’s Linux performance led to the decision to abide by the GPL-2 rules and use the kernel code to improve the drivers. It’s known that some outside developers have been interested in solving that problem; with Microsoft taking up the cause and agreeing to do the right thing, it seems that legal problems would be nipped in the bud. No way is that a bad thing; we don’t need yet another legal squabble between Redmond and the FOSS community.

Here’s a little secret, though: Microsoft may still be trying to kill us all. If you’re worried about three chunks of very specific performance-related code going into the kernel, though, don’t. Instead, take a look at the barriers Microsoft throws up for people wanting to work on Wine. Ponder the pernicious, unending problems certain fonts cause in that process. Don’t worry so much about the guys trying to make Microsoft look better next to Linux by improving Hyper-V’s performance; give a good steady look instead at all the barriers Microsoft puts up that might make other options look worse. The efforts may be twinned, but the first is perfectly acceptable behavior from Microsoft or any other concern wanting Linux support for their wares. The latter… well, that’s how bad reputations get started, isn’t it?