1. 22 Nov, 2005 26 commits
    • Eric Paris's avatar
      [PATCH] hugetlb: fix race in set_max_huge_pages for multiple updaters of nr_huge_pages · 0bd0f9fb
      Eric Paris authored
      If there are multiple updaters to /proc/sys/vm/nr_hugepages simultaneously
      it is possible for the nr_huge_pages variable to become incorrect.  There
      is no locking in the set_max_huge_pages function around
      alloc_fresh_huge_page which is able to update nr_huge_pages.  Two callers
      to alloc_fresh_huge_page could race against each other as could a call to
      alloc_fresh_huge_page and a call to update_and_free_page.  This patch just
      expands the area covered by the hugetlb_lock to cover the call into
      alloc_fresh_huge_page.  I'm not sure how we could say that a sysctl section
      is performance critical where more specific locking would be needed.
      
      My reproducer was to run a couple copies of the following script
      simultaneously
      
      while [ true ]; do
      	echo 1000 > /proc/sys/vm/nr_hugepages
      	echo 500 > /proc/sys/vm/nr_hugepages
      	echo 750 > /proc/sys/vm/nr_hugepages
      	echo 100 > /proc/sys/vm/nr_hugepages
      	echo 0 > /proc/sys/vm/nr_hugepages
      done
      
      and then watch /proc/meminfo and eventually you will see things like
      
      HugePages_Total:     100
      HugePages_Free:      109
      
      After applying the patch all seemed well.
      Signed-off-by: default avatarEric Paris <eparis@redhat.com>
      Acked-by: default avatarWilliam Irwin <wli@holomorphy.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      0bd0f9fb
    • Antonino A. Daplas's avatar
      [PATCH] vgacon: Fix usage of stale height value on vc initialization · 5ef897c7
      Antonino A. Daplas authored
      Reported by: Wayne E. Harlan
      
      "[1.] One line summary of the problem:
      When the kernel option "vga=1" is used, additional tty's (alt+control+Fx
      with x=2,3,4,5, etc) do not provide the full 50 lines of output.  The first
      one does have 50 lines, however.
      
      [2.] Full description of the problem/report:
      These addtitional tty's show only 39 lines plus the top pixel of the 40-th
      line.  The remaining lines are black and not shown.  Kernel version
      2.6.13.4 does not show this problem."
      
      This bug is caused by using a stale font height value on vgacon_init.
      
      Booting with vga=1 gives an 80x50 screen with an 8x8 font.  Somewhere
      during the initialization, the font was changed to 8x9 and the first
      vc was correctly resized to 80x44.  However, the rest of the vc's were
      not allocated yet, and when they were subsequently initialized, they
      still used a font height of 8 (instead of 9) causing the mentioned bug.
      
      Fix by saving the new font height to vga_video_font_height.
      Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      5ef897c7
    • Antonino A. Daplas's avatar
      [PATCH] fbcon: Console Rotation - Fix wrong shift calculation · b4627dea
      Antonino A. Daplas authored
      The shift value (amount to shift the bitmap so first pixel starts at
      origin(0,0)) is incorrect.  This causes corrupted characters or a kernel crash
      if fontwidth is not divisible by 8 at 270 degrees, or fontheight not divisible
      by 8 at 180 degrees.
      
      Report and part of the fix contributed by Knut Petersen.
      Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      b4627dea
    • David Gibson's avatar
      [PATCH] Fix hugetlbfs_statfs() reporting of block limits · 74a8a65c
      David Gibson authored
      Currently, if a hugetlbfs is mounted without limits (the default), statfs()
      will return -1 for max/free/used blocks.  This does not appear to be in
      line with normal convention: simple_statfs() and shmem_statfs() both return
      0 in similar cases.  Worse, it confuses the translation logic in
      put_compat_statfs(), causing it to return -EOVERFLOW on such a mount.
      
      This patch alters hugetlbfs_statfs() to return 0 for max/free/used blocks
      on a mount without limits.  Note that we need the test in the patch below,
      rather than just using 0 in the sbinfo structure, because the -1 marked in
      the free blocks field is used internally to tell the
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      74a8a65c
    • David Gibson's avatar
      [PATCH] Fix error handling with put_compat_statfs() · 86e07ce7
      David Gibson authored
      In fs/compat.c, whenever put_compat_statfs() returns an error, the
      containing syscall returns -EFAULT.  This is presumably by analogy with the
      non-compat case, where any non-zero code from copy_to_user() should be
      translated into an EFAULT.  However, put_compat_statfs() is also return
      -EOVERFLOW.  The same applies for put_compat_statfs64().
      
      This bug can be observed with a statfs() on a hugetlbfs directory.
      hugetlbfs, when mounted without limits reports available, free and total
      blocks as -1 (itself a bug, another patch coming).  statfs() will
      mysteriously return EFAULT although it's parameters are perfectly valid
      addresses.
      
      This patch causes the compat versions of statfs() and statfs64() to
      correctly propogate the return values from put_compat_statfs() and
      put_compat_statfs64().
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      86e07ce7
    • Hugh Dickins's avatar
      [PATCH] unpaged: fix sound Bad page states · f3d48f03
      Hugh Dickins authored
      Earlier I unifdefed PageCompound, so that snd_pcm_mmap_control_nopage and
      others can give out a 0-order component of a higher-order page, which won't
      be mistakenly freed when zap_pte_range unmaps it.  But many Bad page states
      reported a PG_reserved was freed after all: I had missed that we need to
      say __GFP_COMP to get compound page behaviour.
      
      Some of these higher-order pages are allocated by snd_malloc_pages, some by
      snd_malloc_dev_pages; or if SBUS, by sbus_alloc_consistent - but that has
      no gfp arg, so add __GFP_COMP into its sparc32/64 implementations.
      
      I'm still rather puzzled that DRM seems not to need a similar change.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      f3d48f03
    • Hugh Dickins's avatar
      [PATCH] unpaged: copy_page_range vma · 0b0db14c
      Hugh Dickins authored
      For copy_one_pte's print_bad_pte to show the task correctly (instead of
      "???"), dup_mmap must pass down parent vma rather than child vma.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      0b0db14c
    • Hugh Dickins's avatar
      [PATCH] unpaged: PG_reserved bad_page · 689bcebf
      Hugh Dickins authored
      It used to be the case that PG_reserved pages were silently never freed, but
      in 2.6.15-rc1 they may be freed with a "Bad page state" message.  We should
      work through such cases as they appear, fixing the code; but for now it's
      safer to issue the message without freeing the page, leaving PG_reserved set.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      689bcebf
    • Hugh Dickins's avatar
      [PATCH] unpaged: ZERO_PAGE in VM_UNPAGED · f57e88a8
      Hugh Dickins authored
      It's strange enough to be looking out for anonymous pages in VM_UNPAGED areas,
      let's not insert the ZERO_PAGE there - though whether it would matter will
      depend on what we decide about ZERO_PAGE refcounting.
      
      But whereas do_anonymous_page may (exceptionally) be called on a VM_UNPAGED
      area, do_no_page should never be: just BUG_ON.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      f57e88a8
    • Hugh Dickins's avatar
      [PATCH] unpaged: anon in VM_UNPAGED · ee498ed7
      Hugh Dickins authored
      copy_one_pte needs to copy the anonymous COWed pages in a VM_UNPAGED area,
      zap_pte_range needs to free them, do_wp_page needs to COW them: just like
      ordinary pages, not like the unpaged.
      
      But recognizing them is a little subtle: because PageReserved is no longer a
      condition for remap_pfn_range, we can now mmap all of /dev/mem (whether the
      distro permits, and whether it's advisable on this or that architecture, is
      another matter).  So if we can see a PageAnon, it may not be ours to mess with
      (or may be ours from elsewhere in the address space).  I suspect there's an
      entertaining insoluble self-referential problem here, but the page_is_anon
      function does a good practical job, and MAP_PRIVATE PROT_WRITE VM_UNPAGED will
      always be an odd choice.
      
      In updating the comment on page_address_in_vma, noticed a potential NULL
      dereference, in a path we don't actually take, but fixed it.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      ee498ed7
    • Hugh Dickins's avatar
      [PATCH] unpaged: COW on VM_UNPAGED · 920fc356
      Hugh Dickins authored
      Remove the BUG_ON(vma->vm_flags & VM_UNPAGED) from do_wp_page, and let it do
      Copy-On-Write without touching the VM_UNPAGED's page counts - but this is
      incomplete, because the anonymous page it inserts will itself need to be
      handled, here and in other functions - next patch.
      
      We still don't copy the page if the pfn is invalid, because the
      copy_user_highpage interface does not allow it.  But that's not been a problem
      in the past: can be added in later if the need arises.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      920fc356
    • Hugh Dickins's avatar
      [PATCH] unpaged: VM_NONLINEAR VM_RESERVED · 101d2be7
      Hugh Dickins authored
      There's one peculiar use of VM_RESERVED which the previous patch left behind:
      because VM_NONLINEAR's try_to_unmap_cluster uses vm_private_data as a swapout
      cursor, but should never meet VM_RESERVED vmas, it was a way of extending
      VM_NONLINEAR to VM_RESERVED vmas using vm_private_data for some other purpose.
       But that's an empty set - they don't have the populate function required.  So
      just throw away those VM_RESERVED tests.
      
      But one more interesting in rmap.c has to go too: try_to_unmap_one will want
      to swap out an anonymous page from VM_RESERVED or VM_UNPAGED area.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      101d2be7
    • Hugh Dickins's avatar
      [PATCH] unpaged: VM_UNPAGED · 0b14c179
      Hugh Dickins authored
      Although we tend to associate VM_RESERVED with remap_pfn_range, quite a few
      drivers set VM_RESERVED on areas which are then populated by nopage.  The
      PageReserved removal in 2.6.15-rc1 changed VM_RESERVED not to free pages in
      zap_pte_range, without changing those drivers not to set it: so their pages
      just leak away.
      
      Let's not change miscellaneous drivers now: introduce VM_UNPAGED at the core,
      to flag the special areas where the ptes may have no struct page, or if they
      have then it's not to be touched.  Replace most instances of VM_RESERVED in
      core mm by VM_UNPAGED.  Force it on in remap_pfn_range, and the sparc and
      sparc64 io_remap_pfn_range.
      
      Revert addition of VM_RESERVED to powerpc vdso, it's not needed there.  Is it
      needed anywhere?  It still governs the mm->reserved_vm statistic, and special
      vmas not to be merged, and areas not to be core dumped; but could probably be
      eliminated later (the drivers are probably specifying it because in 2.4 it
      kept swapout off the vma, but in 2.6 we work from the LRU, which these pages
      don't get on).
      
      Use the VM_SHM slot for VM_UNPAGED, and define VM_SHM to 0: it serves no
      purpose whatsoever, and should be removed from drivers when we clean up.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Acked-by: default avatarWilliam Irwin <wli@holomorphy.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      0b14c179
    • Hugh Dickins's avatar
      [PATCH] unpaged: unifdefed PageCompound · 664beed0
      Hugh Dickins authored
      It looks like snd_xxx is not the only nopage to be using PageReserved as a way
      of holding a high-order page together: which no longer works, but is masked by
      our failure to free from VM_RESERVED areas.  We cannot fix that bug without
      first substituting another way to hold the high-order page together, while
      farming out the 0-order pages from within it.
      
      That's just what PageCompound is designed for, but it's been kept under
      CONFIG_HUGETLB_PAGE.  Remove the #ifdefs: which saves some space (out- of-line
      put_page), doesn't slow down what most needs to be fast (already using
      hugetlb), and unifies the way we handle high-order pages.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      664beed0
    • Hugh Dickins's avatar
      [PATCH] unpaged: sound nopage get_page · 1cdca61b
      Hugh Dickins authored
      Something noticed when studying use of VM_RESERVED in different drivers:
      snd_usX2Y_hwdep_pcm_vm_nopage omitted to get_page: fixed.
      
      And how did this work before?  Aargh!  That nopage is returning a page from
      within a buffer allocated by snd_malloc_pages, which allocates a high-order
      page, then does SetPageReserved on each 0-order page within.
      
      That would have worked in 2.6.14, because when the area was unmapped,
      PageReserved inhibited put_page.  2.6.15-rc1 removed that inhibition (while
      leaving ineffective PageReserveds around for now), but it hasn't caused
      trouble because..  we've not been freeing from VM_RESERVED at all.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      1cdca61b
    • Hugh Dickins's avatar
      [PATCH] unpaged: private write VM_RESERVED · 83e9b7e9
      Hugh Dickins authored
      The PageReserved removal in 2.6.15-rc1 issued a "deprecated" message when you
      tried to mmap or mprotect MAP_PRIVATE PROT_WRITE a VM_RESERVED, and failed
      with -EACCES: because do_wp_page lacks the refinement to COW pages in those
      areas, nor do we expect to find anonymous pages in them; and it seemed just
      bloat to add code for handling such a peculiar case.  But immediately it
      caused vbetool and ddcprobe (using lrmi) to fail.
      
      So revert the "deprecated" messages, letting mmap and mprotect succeed.  But
      leave do_wp_page's BUG_ON(vma->vm_flags & VM_RESERVED) in place until we've
      added the code to do it right: so this particular patch is only good if the
      app doesn't really need to write to that private area.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      83e9b7e9
    • Hugh Dickins's avatar
      [PATCH] unpaged: get_user_pages VM_RESERVED · ed5297a9
      Hugh Dickins authored
      The PageReserved removal in 2.6.15-rc1 prohibited get_user_pages on the areas
      flagged VM_RESERVED in place of PageReserved.  That is correct in theory - we
      ought not to interfere with struct pages in such a reserved area; but in
      practice it broke BTTV for one.
      
      So revert to prohibiting only on VM_IO: if someone gets into trouble with
      get_user_pages on VM_RESERVED, it'll just be a "don't do that".
      
      You can argue that videobuf_mmap_mapper shouldn't set VM_RESERVED in the first
      place, but now's not the time for breaking drivers without notice.
      Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      ed5297a9
    • Jeff Dike's avatar
      [PATCH] uml: eliminate use of libc PAGE_SIZE · aa1a64ee
      Jeff Dike authored
      On some systems, libc PAGE_SIZE calls getpagesize, which can't happen from a
      stub.  So, I use UM_KERN_PAGE_SIZE, which is less variable in its definition,
      instead.
      Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      aa1a64ee
    • Jeff Dike's avatar
      [PATCH] uml: properly invoke x86_64 system calls · 17d46971
      Jeff Dike authored
      This patch makes stub_segv use the stub_syscall macros.  This was needed
      anyway, but the bug that prompted this was the discovery that gcc was storing
      stuff in RCX, which is trashed across a system call.  This is exactly the sort
      of problem that the new macros fix.
      
      There is a stub_syscall0 for getpid.  stub_segv was changed to be a libc file,
      and that caused some include changes.
      Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      17d46971
    • Jeff Dike's avatar
      [PATCH] uml: eliminate anonymous union and clean up symlink lossage · e23181de
      Jeff Dike authored
      This gives a name to the anonymous union introduced in skas-hold-own-ldt,
      allowing to build on a wider range of gccs.
      
      It also removes ldt.h, which somehow became real, and replaces it with a
      symlink, and creates ldt-x86_64.h as a copy of ldt-i386.h for now.
      Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      e23181de
    • Jeff Dike's avatar
      [PATCH] uml: eliminate use of local in clone stub · 39d730ab
      Jeff Dike authored
      We have a bug in the i386 stub_syscall6 which pushes ebp before the system
      call and pops it afterwards.  Because we use syscall6 to remap the stack, the
      old contents of the stack (and the former value of ebp) are no longer
      available.  Some versions of gcc make from a real local, accessed through ebp,
      despite my efforts to make it obvious that references to from are really
      constants.  This patch attempts to make it even more obvious by eliminating
      from and using a macro to access the stub's data explicitly with constants.
      
      My original thinking on this was to replace syscall6 with a remap_stack
      interface which saved ebp someplace and restored it afterwards.  The problem
      is that there are no registers to put it in, except for esp.  That could work,
      since we can store a constant in esp after the mmap because we just replaced
      the stack.  However, this approach seems a tad cleaner.
      Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      39d730ab
    • Richard Knutsson's avatar
      [PATCH] net: Fix compiler-error on dgrs.c when !CONFIG_PCI · 18317ab0
      Richard Knutsson authored
      drivers/net/dgrs.c: In function `dgrs_init_module':
      drivers/net/dgrs.c:1598: `dgrs_pci_driver' undeclared (first use in this function)
      Signed-off-by: default avatarRichard Knutsson <ricknu-0@student.ltu.se>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      18317ab0
    • Linus Torvalds's avatar
    • Linus Torvalds's avatar
      5ea8051a
    • Linus Torvalds's avatar
      66b5920f
    • Linus Torvalds's avatar
  2. 21 Nov, 2005 14 commits