|
|
Log in / Subscribe / Register

Kernel development

Brief items

Kernel release status

The current development kernel is 4.0-rc6, released on March 29. According to Linus: "Things are calming down nicely, and there are fixes all over. The NUMA balancing performance regression is fixed, and things are looking up again in general. There were a number of i915 issues and a KVM double-fault thing that meant that for a while there I was pretty sure that this would be a release that will go to rc8, but that may be unnecessary."

Stable updates: 3.19.3 was released on March 26; 3.14.37 and 3.10.73 followed on the 27th.

Comments (none posted)

Quotes of the week

This patchset proposes a solution. The support for negative number of CPUs is able to help scale computing up to O(-NR_CPUS). The more you have CPUs the higher you scale, to the point that software execution should complete before you start writing that software (assuming you have around -1024 CPUs). And programming gets even more simple because you have lesser CPUs to handle.

Now keep in mind this patchset is only a draft. Not build tested and I don't have the hardware yet.

Frederic Weisbecker

32-bit code is old, full of nasty hacks and keeps always breaking when we do our shiny new features for 64-bit. And frankly, no one cares about 32-bit. If you do, then you're wrong and you need to get with the program. Go out, take a deep breath, go for a walk and the first thing you do when you come back is *take* *a* *look* at the goddam calendar. Time to say goodbye to your old 32-bit sand. Get a 64-bit processor. Live a little. Come to the real world.
Borislav Petkov

Comments (13 posted)

Kernel development news

Attaching file descriptors to processes with CLONE_FD

By Jonathan Corbet
April 1, 2015
The classic Unix system design has many advantages, but friendliness to library code is not always one of them. The problem, at its core, is the use of global structures and mechanisms that cannot be manipulated independently by an application and any libraries it may use; the file descriptor table and signal handling vectors are a couple of examples. A recently posted patch set is trying to address a little piece of this problem, but may point the way toward a larger long-term change in how processes are managed in Linux.

Consider a library that needs to create a child process with fork() and be notified when that process exits. The library cannot call wait() without blocking the entire calling process and, possibly, interfering with the reaping of any child processes created elsewhere in the application. Receiving asynchronous notifications with the SIGCHLD signal has a similar problem: there can only be one SIGCHLD handler, so catching it in the library clashes with the application's use of that signal. The need to avoid this kind of conflict with application code can greatly limit what can be done within a library.

Josh Triplett's CLONE_FD patch set is an attempt to solve that particular problem. It adds a new flag, CLONE_FD, to a variant of the clone() system call (called clone4()); if that flag is present, a successful clone4() will return a file descriptor referring to the process it just created. There is little that can be done with that descriptor by default, but, if the CLONE_AUTOREAP flag is also set, the system's behavior changes somewhat.

In particular, when a process created with CLONE_AUTOREAP exits, it will be cleaned up immediately rather than sitting in the "zombie" state until the parent process gets around to calling wait(). This behavior can be useful in its own right if the parent process is not concerned about when the child exits. If the parent does care about its child's exit, though, it can create a process file descriptor with CLONE_FD; that descriptor will become readable when the process exits. In particular, it will be possible to read a structure like:

    struct clonefd_info {
	uint32_t code;   /* Signal code */
	uint32_t status; /* Exit status or signal */
	uint64_t utime;  /* User CPU time */
	uint64_t stime;  /* System CPU time */
    };

With this mechanism in place, a library function can create a process and wait for it to complete without interfering with process management anywhere else in the program. It thus solves the problem of having to share the machinery for managing process exit information by removing that sharing and, essentially, turning a running process into a sort of "file" that can be tracked and managed exclusively by the code that knows about it.

There was one tiny little problem in the way of implementing this solution, though: there is no room for additional flags for the clone() system call. So Josh had to create a new one, which he called clone4(). The intended interface, as presented by the C library, is:

    int clone4(uint64_t flags, size_t args_size, struct clone4_args *args,
               int (*fn)(void *), void *arg);

The flags field holds the flags to the operation: the traditional clone() flags and the new ones described above. As with clone(), the child process will call fn(arg) after its creation. The args argument looks like this:

    struct clone4_args {
	pid_t *ptid;
	pid_t *ctid;
	unsigned long stack_start;
	unsigned long stack_size;
	unsigned long tls;
	int *clonefd;
	unsigned clonefd_flags;
    };

Most of these fields match arguments passed to the clone() call; they have just been moved into a separate structure. The clonefd and clonefd_flags fields are new, though; the first is a location to store the created file descriptor when CLONE_FD is passed; the second can hold the O_CLOEXEC and O_NONBLOCK flags to be applied to that file descriptor.

The size of the clone4_args structure must be passed separately in args_size. If fields must be added to this structure in the future, the passed size will allow the kernel to determine which version of the structure is in use and respond accordingly.

For completeness, the actual system call (invoked from the C library wrapper) looks like this:

    int clone4(unsigned flags_high, unsigned flags_low,
               unsigned long args_size,
               struct clone4_args *args);

At this level, clone4() behaves like fork(), returning into both the parent and child processes (but with different return values).

This functionality is useful enough, but the patch description also includes this intriguing note:

The CLONE_FD file descriptor uniquely identifies a process on the system in a race-free way, by holding a reference to the task_struct. In the future, we may introduce APIs that support using process file descriptors instead of PIDs.

Process IDs (PIDs) are subject to a narrow race condition: a process could exit and be replaced by another using the same PID. In a system where there are many processes running and there is a lot of fork activity, the probability of short-term PID reuse is significant, especially if, as is usually the case, the range of available PIDs has not been increased beyond the traditional 32,768. A file descriptor that is attached to a process at creation time is not subject to this race, though; it should thus be safer for other processes to operate on.

Adding file-descriptor-oriented process-management system calls is a future exercise, though; for now, the CLONE_FD functionality solves the immediate problem. This patch has been through two rounds of review so far; some significant changes have been made, but the core functionality seems to be uncontroversial. One more review round seems likely to happen, though; after that, this feature could conceivably be added as early as the 4.2 development cycle.

Comments (51 posted)

Statistics from the 4.0 development cycle

By Jonathan Corbet
April 1, 2015
The 4.0 kernel development cycle is heading toward its close; the final release can be expected on, mostly likely, April 12 (or possibly April 19 if a late regression turns up). This release will be notable for the new major version number, of course, even though the shift to 4.x does not mean anything more than "the minor numbers were getting too big." It may also be notable for being one of the slower development cycles in the last couple of years, though one should bear in mind that "slow" is used in a relative sense here.

To be specific, as of this writing, the 4.0 cycle has seen the addition of just over 10,000 non-merge changesets to the mainline repository. 1,403 developers have contributed to this release cycle so far; they have added 403,000 lines of code and removed 222,000 for a net growth of 181,000 lines. The list of the most active developers looks a bit different than it has in the last few cycles:

Most active 4.0 developers
By changesets
Lars-Peter Clausen1791.8%
Takashi Iwai1721.7%
H Hartley Sweeten1531.5%
Rickard Strandqvist1111.1%
Antti Palosaari950.9%
Thierry Reding940.9%
Geert Uytterhoeven880.9%
Ian Abbott880.9%
Maxime Ripard850.8%
Michael S. Tsirkin820.8%
Marcel Holtmann790.8%
Ben Skeggs770.8%
Arnd Bergmann760.8%
Laurent Pinchart750.7%
Rasmus Villemoes750.7%
Al Viro710.7%
Trond Myklebust710.7%
Andy Shevchenko660.7%
Krzysztof Kozlowski640.6%
Christophe Ricard620.6%
By changed lines
Ben Skeggs235874.8%
Hans Verkuil164333.3%
Thomas Petazzoni106422.1%
Tero Kristo93411.9%
Hariprasad Shenai88101.8%
Michal Kazior78781.6%
H Hartley Sweeten69251.4%
Laurent Pinchart68031.4%
Dudley Du53991.1%
Takashi Iwai51371.0%
Antti Palosaari49131.0%
Boris Brezillon46660.9%
Christoph Hellwig43650.9%
Arnd Bergmann39740.8%
Rusty Russell39630.8%
Tony Lindgren39600.8%
Rickard Strandqvist39210.8%
Magnus Damm37710.8%
Andrzej Pietrasiewicz36970.7%
Maxime Ripard36640.7%

For once, Hartley Sweeten's work on the Comedi drivers did not put him at the top of the "by changesets" list; that place was taken by Lars-Peter Clausen, who worked mostly in the audio and media driver trees. Takashi Iwai's work remains entirely within the audio subsystem tree. Below Hartley, Richard Strandqvist cleaned up a lot of dead code throughout the tree, while Antti Palosaari did a lot of work in the media driver subsystem.

In the "lines changed" column, Ben Skeggs carried out a massive renaming of symbols in the Nouveau driver; "nouveau" became "nvkm" in the parts of the code that make up the direct-rendering kernel module. Hans Verkuil continues to do work throughout the media subsystem; the bulk of his changed lines, though, took the form of removing some old, unloved drivers. Thomas Petazzoni added a number of framebuffer drivers to the staging tree, Tero Kristo cleaned up and enhanced the TI OMAP clock subsystem, and Hariprasad Shenai did a bunch of work on the cxgb4 network/InfiniBand drivers.

For some years, work on the staging tree has tended to dominate these two lists, but that is not the case for 4.0. Indeed, this is one of the slowest development cycles for the staging tree in general, as can be seen in the plot below:

[Staging patches plot]

The slow traffic in the staging tree explains much of the relative slowness of the 4.0 development cycle in general.

There are 197 employers who are known to have supported development of the 4.0 kernel. The most active of these were:

Most active 4.0 employers
By changesets
Intel116411.6%
(None)8648.6%
(Unknown)7127.1%
Red Hat7037.0%
SUSE4634.6%
Linaro4014.0%
Samsung3613.6%
(Consultant)3363.3%
Free Electrons2512.5%
IBM2262.2%
Renesas Electronics1881.9%
Freescale1651.6%
Google1541.5%
Vision Engraving Systems1531.5%
Primary Data1491.5%
AMD1421.4%
Texas Instruments1391.4%
Oracle1371.4%
Qualcomm1201.2%
ARM1191.2%
By lines changed
Intel490629.9%
Red Hat465889.4%
(None)341716.9%
Samsung238354.8%
Free Electrons229434.6%
Texas Instruments223954.5%
(Unknown)223694.5%
Cisco194383.9%
Linaro175533.5%
SUSE117642.4%
Renesas Electronics107962.2%
(Consultant)107192.2%
Chelsio104392.1%
IBM103552.1%
Code Aurora Forum96972.0%
Tieto81151.6%
ARM73161.5%
Vision Engraving Systems69251.4%
Qualcomm68501.4%
AMD67811.4%

In the 3.19 development statistics article, we noted that developers with no affiliation (volunteers) were holding steady at about 11% of the total changeset contribution. The accompanying suggestion that the decline in volunteer developers could be ending may have been premature, though; in 4.0, only 8.6% of the (relatively low) changeset count came from volunteers. That is the lowest point since 3.10 and the second-lowest ever.

Otherwise, there is not much that jumps out from the above table; corporate support for kernel development doesn't change a whole lot from one development cycle to the next.

As of this writing, there are about 6,500 non-merge changesets in the linux-next tree, putting linux-next in a place similar to where it was at this point in the 3.19 development cycle. That suggests that, unless things change, 4.1 will be another relatively slow cycle — though, it bears repeating, the incorporation of over 10,000 changes in a development cycle lasting less than three months is not all that slow. Even if we are not setting records at the moment, it seems clear that the kernel development community remains strong and active.

Comments (none posted)

XFS: There and back ... and there again?

By Jake Edge
April 1, 2015

Vault 2015

In a thought-provoking—and characteristically amusing—talk at the Vault conference, Dave Chinner looked at the history of XFS, its current status, and where the filesystem may be heading. In keeping with the title of the talk (shared by this article), he sees parallels in what drove the original development of XFS and what will be driving new filesystems. Chinner's vision of the future for today's filesystems, and not just of XFS, may be a bit surprising or controversial—possibly both.

History

In the early 1990s, "before I knew who SGI was", Chinner said, storage was exceeding capacities that could be addressed with 32 bits. The existing filesystem for SGI's Unix, IRIX, was the Extent File System (EFS) that only supported 32-bit addresses. At that time, 64-bit CPUs with large-scale multiprocessing were coming on, but systems with hundreds of disks were not performing well.

XFS came about to fix those problems. The "x" originally just meant "undefined". This new undefined filesystem, xFS, had to support a number of features: fast crash recovery, large filesystems with both sparse and contiguous large files, and filesystems and directories that could hold huge numbers of files. The filesystem would need to support terabyte and petabyte capacities in the foreseeable future at that time, he said.

[Dave Chinner]

Chinner showed a graph of the lines of code changed in XFS over time that went all the way back to the beginning and up through commits from the previous week. Because the full commit history for XFS is available, graphs like that can be made, he said. Another way to use the history is to track bugs back to their introduction. The oldest bug anyone has found in recent times was 19 years old, he said.

The first production release of XFS was in December 1994 in conjunction with the release of IRIX 5.3. In mid-1996, XFS became the default filesystem in IRIX 6.2. The on-disk format had already gone through four versions. Even those early versions had the "feature mask" that allows XFS filesystems to turn on or off individual filesystem features. Those can be set for a particular filesystem at mkfs time; the mask will be consulted for various types of operations. It is a feature of XFS that makes it particularly flexible.

The "IRIX years" of the late 1990s saw various feature additions. Hardware RAID array support was added in 1997, which resulted in XFS gaining the ability to align its allocations to match the geometry of the underlying storage. By 1999, the original directory structure was showing its age, so version 2 directories were added, increasing directory scalability to tens of millions of files. Chinner has personally tried 350 million files in a directory, but he doesn't recommend it; running ls on such a directory takes twelve hours, he said with a laugh.

Shift to Linux

Shortly thereafter, feature development in XFS on IRIX slowed down. SGI had shifted its focus to large NUMA machines and distributed IRIX; development moved from XFS to the new CXFS cluster filesystem. But SGI also had a new product line that was based on Linux, which didn't have a filesystem with the features of XFS. So a team was formed in Melbourne, Australia to port XFS to Linux.

In 2000, XFS was released under the GPL. The first stable release of XFS for Linux came in 2001. And, in 2002, XFS was merged into the mainline for Linux 2.5.36.

One of the unfortunate side effects of XFS and other filesystems being merged into Linux was the proliferation of what Chinner called "Bonnie++ speed racing". People were using the filesystem benchmarking tool with little knowledge, which resulted in them "twiddling knobs" in the filesystem that they did not understand. The problem with that is that Google still finds those posts today, so those looking for better XFS performance are finding these old posts and following the instructions therein, which leads to the never-ending "noatime,nodiratime,logbufs=8 meme" for XFS mount options.

In the early 2000s, the Linux version of XFS started to diverge from the IRIX version with the group quotas feature. The version 2 log format was added in 2002, which helped make metadata performance much better. Also in 2002 came inode cluster delete and configurable sector sizes for XFS. In 2004, the 2.4 and 2.6 development trees were unified and the feature mask was expanded. XFS had run out of bits in the feature mask, he said, so the last bit was used to indicate that there is an additional feature mask to be consulted.

A "major achievement" was unlocked in 2004, when SUSE shipped full XFS support in SUSE Linux Enterprise Server (SLES) 9. It was a validation of all the work that SGI had done on the filesystem, he said. Someone from the audience spoke up to say that SLES 8 had shipped with XFS support in 2001, which seemed to surprise Chinner a bit.

The mid-2000s saw lots of misinformation spread about XFS (and other filesystems) during the "filesystem wars", Chinner said. His slides [PDF] contain several quotes from that time about "magical" features, including large capacitors in SGI power supplies that caused XFS not to lose data on power failure, zeroing of data after an unlink operation so that undelete was not possible, and the zeroing of all open files when there is an unclean shutdown. None of those were true, but they have become part of the XFS lore.

More features came about in 2005 and 2006. Extended attributes were added into the inode, for example, which resulted in an order-of-magnitude performance improvement for Samba atop XFS. That time frame was also the crossover point where Linux XFS started outperforming IRIX XFS. On Linux 2.6.16, XFS achieved a 10GB/second performance on a 24-processor Altix machine, he said.

A few years further on, the "O_PONIES wars" began. Chinner pointed to a Launchpad bug about an XFS file data corruption problem under certain conditions. The workaround was to use fdatasync() after renaming the file, but that would require changes in user space. The bug was closed as a "Won't fix", but none of the XFS developers were ever even consulted about it. It turns out that it actually was a bug in XFS that was fixed a year later.

Shift to the community

"Sad days" arrived in 2009, when the SGI XFS engineering team was disbanded. The company had been losing money since 1999, he said. The community stepped in to maintain the XFS tree while SGI reorganized. After that, SGI intermittently maintained XFS until the end of 2013; he didn't mention that most of the work during that time was being done by developers (like himself) working at other companies. Chinner said he went away to the racetrack for a weekend and came back to find out that he had been nominated to take over as maintainer.

Since the shutdown of the XFS team, development on the filesystem has largely shifted to the wider community, he said. Development did not slow down as a result, however; if anything, it accelerated. But all of that work is not just about adding code, a lot of code has been removed along the way, as well.

He rhetorically asked if XFS is "still that big, bloated SGI thing"? He put up a graph showing the number of lines of code (LOC) in XFS for each kernel release. The size of the XFS codebase started dropping around 2.6.14, bottomed out in 3.6, rose again until 3.15 or so, and has leveled off since. The level (just under 70,000 LOC) is lower than where the graph started with 2.6.12 (roughly 75,000 LOC). The line for Btrfs crossed that of XFS around 3.5 and it is at 80,000+ and still climbing; it hasn't leveled off, Chinner said.

He listed the top developers for XFS, with Christoph Hellwig at the top, followed closely by Chinner himself. He called out early XFS developers Adam Sweeney and Doug Doucette, noting that they had done "tons of work" in a fairly small number of years. He quoted Isaac Newton ("If I have seen further than others, it is by standing upon the shoulders of giants.") and said that XFS came about "not because of me", but from the work of all of those others on the list.

Recent and ongoing developments in XFS include sparse inode chunk allocation to support GlusterFS and Ceph, unification of the quota API, and reverse mapping for the internal B-trees (more reasons for doing so cropped up at the recently completed LSFMM Summit, he said). In addition, reflink support for per-file snapshots has been added, defragmentation improvements have been made, and support for the direct access block layer (DAX) has been added. There is "lots going on at the moment", he said.

The near future

In among working on all of that, Chinner has been trying to plot out the next five years or so of XFS development. He did a similar exercise back in 2008 and posted some documents to XFS.org. Over the years since then, all of the features in those documents have been ticked off the list, though reverse B-trees, which are 95% complete, are "the last bit". So, now is the time to plan for the future.

There are known storage technologies that are pulling filesystem developers in opposite directions, he said. Shingled magnetic recording (SMR) devices and persistent memory are going to change things radically. The key for developers of existing filesystems is to figure out "good enough" solutions to allow those filesystems to work on SMR and persistent memory devices. Eventually, someone will come up with a filesystem that specifically targets SMR devices or persistent memory that "blows everything else away".

Over the next five or more years, XFS needs to have better integration with the block devices it sits on top of. Information needs to pass back and forth between XFS and the block device, he said. That will allow better support of thin provisioning. It will also help with offloading block clone, copy, and compress operations. There are more uses for that integration as well, including better snapshot awareness and control at the filesystem layer.

Improving reliability is another area where XFS will need more work. Reconnecting orphaned filesystem objects will become possible with the B-tree reverse mapping abilities. That will also allow repairing the filesystem while it is online, rather than having to unmount it to do repairs. Proactive corruption detection is also on the list. When corruption is found, the affected part of the filesystem could be isolated for repair. These features would make XFS "effectively self-healing", Chinner said.

There is a "fairly large amount of work" on the list, he said. While he is targeting five years, he can't do it alone in that time period. If it is just him, it will probably take six or seven years, he said with a grin.

Farther out

But we also need to be thinking a little further ahead. Looking at the progression of capacities and access times for "spinning rust" shows 8GB, 7ms drives in the mid-1990s and 8TB, 15ms drives in the mid-2010s. That suggests that the mid-2030s will have 8PB (petabyte, 1000 terabytes) drives with 30ms access times.

The progression in solid-state drives (SSDs) shows slow, unreliable, and "damn expensive" 30GB drives in 2005. Those drives were roughly $10/GB, but today's rack-mounted (3U) 512TB SSDs are less than $1/GB and can achieve 7GB/second performance. That suggests to him that by 2025 we will have 3U SSDs with 8EB (exabyte, 1000 petabytes) capacity at $0.1/GB.

SSDs have lots of compelling features (e.g. density, power consumption, performance) and are cost-competitive. But persistent memory will be even denser and faster, while still being competitive in terms of cost. It is at least five years before we see pervasive persistent memory deployment, however. Chinner did caution that memristors are a wild card that could be "a game changer" for storage.

Those projections indicate that focusing on spinning rust would be largely misplaced. XFS (and other filesystems) have to follow where the hardware is taking them. SSD storage will push capacity, scalability, and performance much faster than SMR technologies will. Though "most of the cat pictures" on the internet will likely be stored on SMR drives before too long, he said with a chuckle.

8EB is about as large as XFS can go. In fact, the 64-bit address space will be exhausted for filesystems and CPUs in the next 10-15 years. Many people thought that the 128-bit addresses used by ZFS were "crazy", but it doesn't necessarily look that way now.

By 2025-2030, XFS will be running up against capacity and addressability limits. It will also be hitting architectural performance limits in addition to complexity limits from continuing to support spinning rust disks. The architecture of XFS will be unsuited to the emerging storage technologies at that time.

All of those projections place a hard limit on the development life of XFS. It doesn't make sense to do a large-scale rework of the filesystem to support SMR devices, for example. SMR will be supported, but the project is "not going to turn everything upside down for it". There is a limited amount of life left in the filesystem at this point and SMR technologies will be outrun by other storage types.

From Btrfs, GlusterFS, Ceph, and others, we know that it takes 5-10 years for a new filesystem to mature. That implies we need to start developing any new filesystems soon. For XFS, there is the definite possibility that this 5-7 year development plan that he is working on will be the last. In 20 years, XFS will be a legacy filesystem. That's likely true for any current filesystem; he may not be right, he said, but if he is, we may well be seeing the last major development cycle for all of the existing filesystems in Linux.

[I would like to thank the Linux Foundation for travel support to Boston for Vault.]

Comments (46 posted)

Patches and updates

Kernel trees

Linus Torvalds Linux 4.0-rc6 ?
Greg KH Linux 3.19.3 ?
Luis Henriques Linux 3.16.7-ckt9 ?
Greg KH Linux 3.10.73 ?
Greg KH Linux 3.14.37 ?

Architecture-specific

Core kernel code

Development tools

Device drivers

Device driver infrastructure

Documentation

Michael Kerrisk (man-pages) Revised futex(2) man page for review ?
Michael Kerrisk (man-pages) man-pages-3.82 is released ?

Filesystems and block I/O

Andreas Gruenbacher Richacls (2) ?

Networking

Security-related

Miscellaneous

Page editor: Jonathan Corbet
Next page: Distributions>>


Copyright © 2015, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds