Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754833AbbIACzI (ORCPT ); Mon, 31 Aug 2015 22:55:08 -0400 Received: from ipmail06.adl6.internode.on.net ([150.101.137.145]:64635 "EHLO ipmail06.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754715AbbIACzG (ORCPT ); Mon, 31 Aug 2015 22:55:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DzCQCeEuVVPAUaLHldgxtUaYJVp0UMAQEBAQEBBopaiyGFcQQCAoEtTQEBAQEBAQcBAQEBQAE/hCQBAQQ6HCMQCAMYCSUPBSUDBy2ILQ7GNgEBAQcCIBmGEIVBgm2BUE4HhCwFkiiDGYUHh2uab4Q3LDMBAQECgQGBRwEBAQ Date: Tue, 1 Sep 2015 12:51:07 +1000 From: Dave Chinner To: 1439830287.10801.28.camel@decadent.org.uk Cc: Ben Hutchings , Andrew Morton , Michal Hocko , Brian Behlendorf , LKML Subject: Re: [PATCH] mm: Change global memory state symbols to GPL-only Message-ID: <20150901025107.GJ26895@dastard> References: <20150901012453.GA16646@woodpecker.gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150901012453.GA16646@woodpecker.gentoo.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4369 Lines: 93 On Tue, Sep 01, 2015 at 01:24:53AM +0000, Richard Yao wrote: > On Mon, 2015-08-17 09:56:55 -0700, Ben Hutchings wrote: > > On Mon, 2015-08-17 at 17:11 +0200, Michal Hocko wrote: > > > On Mon 17-08-15 16:56:32, Ben Hutchings wrote: > > > > On Mon, 2015-08-17 at 15:54 +0200, Michal Hocko wrote: > > > > > On Sun 16-08-15 01:42:27, Ben Hutchings wrote: > > > > > > Proprietary modules should not be able to touch vm_stat or particip= > > ate > > > > > > in shrinking. > > > > >=20 > > > > > How does the external and !GPL fs does slab reclaim? Those are essent= > > ial > > > > > for the proper memory balancing. > > > >=20 > > > > If they know how to do shrinking on Linux then they are probably > > > > derivative works of Linux. > > >=20 > > > I am not sure I understand. They are shrinking their internal cached > > > objects and that is hardly a derivative work. The shrinker API is only > > > meant to let them know _when_ this should happen and the interface is > > > a pretty much simple callback API. > > > > It is a Linux-specific API and I don't think other kernels provide > > something similar to loadable modules. It enables a module to turn a > > large part of the system RAM into a cache and have the MM effectively > > tell it the correct size of that cache, thus tightly integrating with > > global memory management. > > The idea of providing third party drivers with the hooks that they need to > respond to memory pressure is by no means Linux-specific. In OpenSolaris, there > are counters for drivers to keep track of memory usage and try to stay ahead of > it, which works because there is no direct reclaim. There are also callbacks > for the SLAB code to defragment the caches used by the drivers. Giving non-GPL > drivers to respond to memory pressure seems reasonable. Given how long this has > been the csae, it seems strange to change it now. Especially considering that certain shrinker implementations in the Linux tree can be used to directly refute the "derived work" arguments given above. Yeah, I'm about to ramble on about XFS history again. ;) When XFS was ported to Linux, all the "memory shakers" that XFS used on Irix were either removed or neutered because Linux didn't have any infrastructure to drive them. For example, have a look at the 1996 commit to Irix that introduced XFS quota support. http://oss.sgi.com/cgi-bin/gitweb.cgi?p=archive/xfs-import.git;a=blob;f=fs/xfs/xfs_qm.c;hb=b5a7144e5bd96fa98db6118d040dabad896ba785 Search for xfs_qm_shake() and xfs_qm_shake_freelist(). xfs_qm_shake() is the registered shaker callback that came from the mm subsystem when memory was low. It used a priority level rather than a count of of objects to shrink, but otherwise it's function is identical to a Linux shrinker callback but was written years before an XFS linux port was even thought of. Now fast forward to the introduction of the rudimentary shrinker infrastructure to Linux back in 2002, and we have this XFS commit: http://oss.sgi.com/cgi-bin/gitweb.cgi?p=archive/xfs-import.git;a=commitdiff;h=27a25ec7d0cb324a0129d609edef40a7468a510f Which connected the XFS quota shaker up to the brand spanking new Linux shrinker infrastructure. Check the code that was being run by this linux shrinker - it's clearly the same freelist/shaker code that was originally committed to Irix. The XFS quota shrinker code has change in the 13 years since then, so it's roots are no longer quite so obvious. That, however, doesn't mean we have forgotten where the code originally came from, nor have we forgotten that kernel-based, subsystem-independent memory reclaim callbacks had existed for many, many years in other operating systems before Linux re-invented them. So, IMO, a shrinker implementation in a kernel module does not automatically make the kernel module a derived work of the kernel. The concept is common across many operating systems, and the kernel APIs are sufficiently similar in function and specification that porting shrinkers between different operating systems is a trivial effort.... Just my 2c worth. Cheers, Dave. -- Dave Chinner david@fromorbit.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/