1. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  2. 25 Feb, 2017 1 commit
  3. 26 Jun, 2015 1 commit
    • Daniel Wagner's avatar
      lib/sort: Add 64 bit swap function · ca96ab85
      Daniel Wagner authored
      In case the call side is not providing a swap function, we either use a
      32 bit or a generic swap function.  When swapping around pointers on 64
      bit architectures falling back to use the generic swap function seems
      like an unnecessary waste.
      
      There at least 9 users ('sort' is of difficult to grep for) of sort()
      and all of them use the sort function without a customized swap
      function.  Furthermore, they are all using pointers to swap around:
      
      arch/x86/kernel/e820.c:sanitize_e820_map()
      arch/x86/mm/extable.c:sort_extable()
      drivers/acpi/fan.c:acpi_fan_get_fps()
      fs/btrfs/super.c:btrfs_descending_sort_devices()
      fs/xfs/libxfs/xfs_dir2_block.c:xfs_dir2_sf_to_block()
      kernel/range.c:clean_sort_range()
      mm/memcontrol.c:__mem_cgroup_usage_register_event()
      sound/pci/hda/hda_auto_parser.c:snd_hda_parse_pin_defcfg()
      sound/pci/hda/hda_auto_parser.c:sort_pins_by_sequence()
      
      Obviously, we could improve the swap for other sizes as well
      but this is overkill at this point.
      
      A simple test shows sorting a 400 element array (try to stay in one
      page) with either with u32_swap() or u64_swap() show that the theory
      actually works. This test was done on a x86_64 (Intel Xeon E5-4610)
      machine.
      
      - swap_32:
      
      NumSamples = 100; Min = 48.00; Max = 49.00
      Mean = 48.320000; Variance = 0.217600; SD = 0.466476; Median 48.000000
      each * represents a count of 1
         48.0000 -    48.1000 [    68]: ********************************************************************
         48.1000 -    48.2000 [     0]:
         48.2000 -    48.3000 [     0]:
         48.3000 -    48.4000 [     0]:
         48.4000 -    48.5000 [     0]:
         48.5000 -    48.6000 [     0]:
         48.6000 -    48.7000 [     0]:
         48.7000 -    48.8000 [     0]:
         48.8000 -    48.9000 [     0]:
         48.9000 -    49.0000 [    32]: ********************************
      
      - swap_64:
      
      NumSamples = 100; Min = 44.00; Max = 63.00
      Mean = 48.250000; Variance = 18.687500; SD = 4.322904; Median 47.000000
      each * represents a count of 1
         44.0000 -    45.9000 [    15]: ***************
         45.9000 -    47.8000 [    37]: *************************************
         47.8000 -    49.7000 [    39]: ***************************************
         49.7000 -    51.6000 [     0]:
         51.6000 -    53.5000 [     0]:
         53.5000 -    55.4000 [     0]:
         55.4000 -    57.3000 [     0]:
         57.3000 -    59.2000 [     1]: *
         59.2000 -    61.1000 [     3]: ***
         61.1000 -    63.0000 [     5]: *****
      
      - swap_72:
      
      NumSamples = 100; Min = 53.00; Max = 71.00
      Mean = 55.070000; Variance = 21.565100; SD = 4.643824; Median 53.000000
      each * represents a count of 1
         53.0000 -    54.8000 [    73]: *************************************************************************
         54.8000 -    56.6000 [     9]: *********
         56.6000 -    58.4000 [     9]: *********
         58.4000 -    60.2000 [     0]:
         60.2000 -    62.0000 [     0]:
         62.0000 -    63.8000 [     0]:
         63.8000 -    65.6000 [     0]:
         65.6000 -    67.4000 [     1]: *
         67.4000 -    69.2000 [     4]: ****
         69.2000 -    71.0000 [     4]: ****
      
      - test program:
      
      static int cmp_32(const void *a, const void *b)
      {
      	u32 l = *(u32 *)a;
      	u32 r = *(u32 *)b;
      
      	if (l < r)
      		return -1;
      	if (l > r)
      		return 1;
      	return 0;
      }
      
      static int cmp_64(const void *a, const void *b)
      {
      	u64 l = *(u64 *)a;
      	u64 r = *(u64 *)b;
      
      	if (l < r)
      		return -1;
      	if (l > r)
      		return 1;
      	return 0;
      }
      
      static int cmp_72(const void *a, const void *b)
      {
      	u32 l = get_unaligned((u32 *) a);
      	u32 r = get_unaligned((u32 *) b);
      
      	if (l < r)
      		return -1;
      	if (l > r)
      		return 1;
      	return 0;
      }
      
      static void init_array32(void *array)
      {
      	u32 *a = array;
      	int i;
      
      	a[0] = 3821;
      	for (i = 1; i < ARRAY_ELEMENTS; i++)
      		a[i] = next_pseudo_random32(a[i-1]);
      }
      
      static void init_array64(void *array)
      {
      	u64 *a = array;
      	int i;
      
      	a[0] = 3821;
      	for (i = 1; i < ARRAY_ELEMENTS; i++)
      		a[i] = next_pseudo_random32(a[i-1]);
      }
      
      static void init_array72(void *array)
      {
      	char *p;
      	u32 v;
      	int i;
      
      	v = 3821;
      	for (i = 0; i < ARRAY_ELEMENTS; i++) {
      		p = (char *)array + (i * 9);
      		put_unaligned(v, (u32*) p);
      		v = next_pseudo_random32(v);
      	}
      }
      
      static void sort_test(void (*init)(void *array),
      		      int (*cmp) (const void *, const void *),
      		      void *array, size_t size)
      {
      	ktime_t start, stop;
      	int i;
      
      	for (i = 0; i < 10000; i++) {
      		init(array);
      
      		local_irq_disable();
      		start = ktime_get();
      
      		sort(array, ARRAY_ELEMENTS, size, cmp, NULL);
      
      		stop = ktime_get();
      		local_irq_enable();
      
      		if (i > 10000 - 101)
      		  pr_info("%lld\n",  ktime_to_us(ktime_sub(stop, start)));
      	}
      }
      
      static void *create_array(size_t size)
      {
      	void *array;
      
      	array = kmalloc(ARRAY_ELEMENTS * size, GFP_KERNEL);
      	if (!array)
      		return NULL;
      
      	return array;
      }
      
      static int perform_test(size_t size)
      {
      	void *array;
      
      	array = create_array(size);
      	if (!array)
      		return -ENOMEM;
      
      	pr_info("test element size %d bytes\n", (int)size);
      	switch (size) {
      	case 4:
      		sort_test(init_array32, cmp_32, array, size);
      		break;
      	case 8:
      		sort_test(init_array64, cmp_64, array, size);
      		break;
      	case 9:
      		sort_test(init_array72, cmp_72, array, size);
      		break;
      	}
      	kfree(array);
      
      	return 0;
      }
      
      static int __init sort_tests_init(void)
      {
      	int err;
      
      	err = perform_test(sizeof(u32));
      	if (err)
      		return err;
      
      	err = perform_test(sizeof(u64));
      	if (err)
      		return err;
      
      	err = perform_test(sizeof(u64)+1);
      	if (err)
      		return err;
      
      	return 0;
      }
      
      static void __exit sort_tests_exit(void)
      {
      }
      
      module_init(sort_tests_init);
      module_exit(sort_tests_exit);
      
      MODULE_LICENSE("GPL v2");
      MODULE_AUTHOR("Daniel Wagner");
      MODULE_DESCRIPTION("sort perfomance tests");
      Signed-off-by: default avatarDaniel Wagner <daniel.wagner@bmw-carit.de>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ca96ab85
  4. 13 Feb, 2015 2 commits
  5. 08 Jan, 2009 1 commit
  6. 17 Oct, 2007 1 commit
  7. 11 Feb, 2007 1 commit
  8. 03 Oct, 2006 1 commit
  9. 31 Oct, 2005 1 commit
    • Tim Schmielau's avatar
      [PATCH] fix missing includes · 4e57b681
      Tim Schmielau authored
      I recently picked up my older work to remove unnecessary #includes of
      sched.h, starting from a patch by Dave Jones to not include sched.h
      from module.h. This reduces the number of indirect includes of sched.h
      by ~300. Another ~400 pointless direct includes can be removed after
      this disentangling (patch to follow later).
      However, quite a few indirect includes need to be fixed up for this.
      
      In order to feed the patches through -mm with as little disturbance as
      possible, I've split out the fixes I accumulated up to now (complete for
      i386 and x86_64, more archs to follow later) and post them before the real
      patch.  This way this large part of the patch is kept simple with only
      adding #includes, and all hunks are independent of each other.  So if any
      hunk rejects or gets in the way of other patches, just drop it.  My scripts
      will pick it up again in the next round.
      Signed-off-by: default avatarTim Schmielau <tim@physik3.uni-rostock.de>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      4e57b681
  10. 10 Sep, 2005 1 commit
  11. 05 May, 2005 1 commit
  12. 16 Apr, 2005 1 commit
    • Linus Torvalds's avatar
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds authored
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4