1. 09 10月, 2012 1 次提交
    • K
      mm: kill vma flag VM_RESERVED and mm->reserved_vm counter · 314e51b9
      Konstantin Khlebnikov 提交于
      A long time ago, in v2.4, VM_RESERVED kept swapout process off VMA,
      currently it lost original meaning but still has some effects:
      
       | effect                 | alternative flags
      -+------------------------+---------------------------------------------
      1| account as reserved_vm | VM_IO
      2| skip in core dump      | VM_IO, VM_DONTDUMP
      3| do not merge or expand | VM_IO, VM_DONTEXPAND, VM_HUGETLB, VM_PFNMAP
      4| do not mlock           | VM_IO, VM_DONTEXPAND, VM_HUGETLB, VM_PFNMAP
      
      This patch removes reserved_vm counter from mm_struct.  Seems like nobody
      cares about it, it does not exported into userspace directly, it only
      reduces total_vm showed in proc.
      
      Thus VM_RESERVED can be replaced with VM_IO or pair VM_DONTEXPAND | VM_DONTDUMP.
      
      remap_pfn_range() and io_remap_pfn_range() set VM_IO|VM_DONTEXPAND|VM_DONTDUMP.
      remap_vmalloc_range() set VM_DONTEXPAND | VM_DONTDUMP.
      
      [akpm@linux-foundation.org: drivers/vfio/pci/vfio_pci.c fixup]
      Signed-off-by: NKonstantin Khlebnikov <khlebnikov@openvz.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Carsten Otte <cotte@de.ibm.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Eric Paris <eparis@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Morris <james.l.morris@oracle.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Suresh Siddha <suresh.b.siddha@intel.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Venkatesh Pallipadi <venki@google.com>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      314e51b9
  2. 04 1月, 2012 1 次提交
    • J
      xen-gntalloc: introduce missing kfree · 2e163414
      Julia Lawall 提交于
      Error handling code following a kmalloc should free the allocated data.
      Out_unlock is used on both success and failure, so free vm_priv before
      jumping to that label.
      
      A simplified version of the semantic match that finds the problem is as
      follows: (http://coccinelle.lip6.fr)
      
      // <smpl>
      @r exists@
      local idexpression x;
      statement S;
      identifier f1;
      position p1,p2;
      expression *ptr != NULL;
      @@
      
      x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
      ...
      if (x == NULL) S
      <... when != x
           when != if (...) { <+...x...+> }
      x->f1
      ...>
      (
       return \(0\|<+...x...+>\|ptr\);
      |
       return@p2 ...;
      )
      
      @script:python@
      p1 << r.p1;
      p2 << r.p2;
      @@
      
      print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
      // </smpl>
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      [v1: Altered the description a bit]
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      2e163414
  3. 17 12月, 2011 2 次提交
  4. 22 11月, 2011 2 次提交
  5. 17 11月, 2011 2 次提交
  6. 10 3月, 2011 1 次提交
    • D
      xen/gntdev,gntalloc: Remove unneeded VM flags · d79647ae
      Daniel De Graaf 提交于
      The only time when granted pages need to be treated specially is when
      using Xen's PTE modification for grant mappings owned by another domain
      (that is, only gntdev on PV guests).  Otherwise, the area does not
      require VM_DONTCOPY and VM_PFNMAP, since it can be accessed just like
      any other page of RAM.
      
      Since the vm_operations_struct close operations decrement reference
      counts, a corresponding open function that increments them is required
      now that it is possible to have multiple references to a single area.
      
      We are careful in the gntdev to check if we can remove those flags. The
      reason that we need to be careful in gntdev on PV guests is because we are
      not changing the PFN/MFN mapping on PV; instead, we change the application's
      page tables to point to the other domain's memory. This means that the vma
      cannot be copied without using another grant mapping hypercall; it also
      requires special handling on unmap, which is the reason for gntdev's
      dependency on the MMU notifier.
      
      For gntalloc, this is not a concern - the pages are owned by the domain
      using the gntalloc device, and can be mapped and unmapped in the same manner
      as any other page of memory.
      Acked-by: NIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: NDaniel De Graaf <dgdegra@tycho.nsa.gov>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [v2: Added in git commit "We are.." from email correspondence]
      d79647ae
  7. 15 2月, 2011 2 次提交