1. 05 1月, 2013 5 次提交
  2. 07 9月, 2012 1 次提交
  3. 31 3月, 2011 1 次提交
  4. 24 3月, 2011 1 次提交
  5. 25 5月, 2010 1 次提交
  6. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  7. 16 12月, 2009 1 次提交
  8. 04 12月, 2009 1 次提交
  9. 14 1月, 2009 1 次提交
  10. 07 6月, 2008 1 次提交
  11. 29 4月, 2008 9 次提交
    • Z
      ipc: add definitions of USHORT_MAX and others · 44f564a4
      Zhang, Yanmin 提交于
      Add definitions of USHORT_MAX and others into kernel.  ipc uses it and slub
      implementation might also use it.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: NZhang Yanmin <yanmin.zhang@intel.com>
      Reviewed-by: NChristoph Lameter <clameter@sgi.com>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Cc: "Pierre Peiffer" <peifferp@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      44f564a4
    • P
      IPC: consolidate all xxxctl_down() functions · a5f75e7f
      Pierre Peiffer 提交于
      semctl_down(), msgctl_down() and shmctl_down() are used to handle the same set
      of commands for each kind of IPC.  They all start to do the same job (they
      retrieve the ipc and do some permission checks) before handling the commands
      on their own.
      
      This patch proposes to consolidate this by moving these same pieces of code
      into one common function called ipcctl_pre_down().
      
      It simplifies a little these xxxctl_down() functions and increases a little
      the maintainability.
      Signed-off-by: NPierre Peiffer <pierre.peiffer@bull.net>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a5f75e7f
    • P
      IPC: introduce ipc_update_perm() · 8f4a3809
      Pierre Peiffer 提交于
      The IPC_SET command performs the same permission setting for all IPCs.  This
      patch introduces a common ipc_update_perm() function to update these
      permissions and makes use of it for all IPCs.
      Signed-off-by: NPierre Peiffer <pierre.peiffer@bull.net>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8f4a3809
    • P
      IPC: get rid of the use *_setbuf structure. · 016d7132
      Pierre Peiffer 提交于
      All IPCs make use of an intermetiate *_setbuf structure to handle the IPC_SET
      command.  This is not really needed and, moreover, it complicates a little bit
      the code.
      
      This patch gets rid of the use of it and uses directly the semid64_ds/
      msgid64_ds/shmid64_ds structure.
      
      In addition of removing one struture declaration, it also simplifies and
      improves a little bit the common 64-bits path.
      Signed-off-by: NPierre Peiffer <pierre.peiffer@bull.net>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      016d7132
    • P
      IPC/message queues: introduce msgctl_down · a0d092fc
      Pierre Peiffer 提交于
      Currently, sys_msgctl is not easy to read.
      
      This patch tries to improve that by introducing the msgctl_down function to
      handle all commands requiring the rwmutex to be taken in write mode (ie
      IPC_SET and IPC_RMID for now).  It is the equivalent function of semctl_down
      for message queues.
      
      This greatly changes the readability of sys_msgctl and also harmonizes the way
      these commands are handled among all IPCs.
      Signed-off-by: NPierre Peiffer <pierre.peiffer@bull.net>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a0d092fc
    • N
      ipc: recompute msgmni on memory add / remove · b6b337ad
      Nadia Derbey 提交于
      Introduce the registration of a callback routine that recomputes msg_ctlmni
      upon memory add / remove.
      
      A single notifier block is registered in the hotplug memory chain for all the
      ipc namespaces.
      
      Since the ipc namespaces are not linked together, they have their own
      notification chain: one notifier_block is defined per ipc namespace.
      
      Each time an ipc namespace is created (removed) it registers (unregisters) its
      notifier block in (from) the ipcns chain.  The callback routine registered in
      the memory chain invokes the ipcns notifier chain with the IPCNS_LOWMEM event.
       Each callback routine registered in the ipcns namespace, in turn, recomputes
      msgmni for the owning namespace.
      Signed-off-by: NNadia Derbey <Nadia.Derbey@bull.net>
      Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Cc: Mingming Cao <cmm@us.ibm.com>
      Cc: Pierre Peiffer <pierre.peiffer@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b6b337ad
    • N
      ipc: scale msgmni to the number of ipc namespaces · 4d89dc6a
      Nadia Derbey 提交于
      Since all the namespaces see the same amount of memory (the total one) this
      patch introduces a new variable that counts the ipc namespaces and divides
      msg_ctlmni by this counter.
      Signed-off-by: NNadia Derbey <Nadia.Derbey@bull.net>
      Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Cc: Mingming Cao <cmm@us.ibm.com>
      Cc: Pierre Peiffer <pierre.peiffer@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4d89dc6a
    • N
      ipc: scale msgmni to the amount of lowmem · f7bf3df8
      Nadia Derbey 提交于
      On large systems we'd like to allow a larger number of message queues.  In
      some cases up to 32K.  However simply setting MSGMNI to a larger value may
      cause problems for smaller systems.
      
      The first patch of this series introduces a default maximum number of message
      queue ids that scales with the amount of lowmem.
      
      Since msgmni is per namespace and there is no amount of memory dedicated to
      each namespace so far, the second patch of this series scales msgmni to the
      number of ipc namespaces too.
      
      Since msgmni depends on the amount of memory, it becomes necessary to
      recompute it upon memory add/remove.  In the 4th patch, memory hotplug
      management is added: a notifier block is registered into the memory hotplug
      notifier chain for the ipc subsystem.  Since the ipc namespaces are not linked
      together, they have their own notification chain: one notifier_block is
      defined per ipc namespace.  Each time an ipc namespace is created (removed) it
      registers (unregisters) its notifier block in (from) the ipcns chain.  The
      callback routine registered in the memory chain invokes the ipcns notifier
      chain with the IPCNS_MEMCHANGE event.  Each callback routine registered in the
      ipcns namespace, in turn, recomputes msgmni for the owning namespace.
      
      The 5th patch makes it possible to keep the memory hotplug notifier chain's
      lock for a lesser amount of time: instead of directly notifying the ipcns
      notifier chain upon memory add/remove, a work item is added to the global
      workqueue.  When activated, this work item is the one who notifies the ipcns
      notifier chain.
      
      Since msgmni depends on the number of ipc namespaces, it becomes necessary to
      recompute it upon ipc namespace creation / removal.  The 6th patch uses the
      ipc namespace notifier chain for that purpose: that chain is notified each
      time an ipc namespace is created or removed.  This makes it possible to
      recompute msgmni for all the namespaces each time one of them is created or
      removed.
      
      When msgmni is explicitely set from userspace, we should avoid recomputing it
      upon memory add/remove or ipcns creation/removal.  This is what the 7th patch
      does: it simply unregisters the ipcns callback routine as soon as msgmni has
      been changed from procfs or sysctl().
      
      Even if msgmni is set by hand, it should be possible to make it back
      automatically recomputed upon memory add/remove or ipcns creation/removal.
      This what is achieved in patch 8: if set to a negative value, msgmni is added
      back to the ipcns notifier chain, making it automatically recomputed again.
      
      This patch:
      
      Compute msg_ctlmni to make it scale with the amount of lowmem.  msg_ctlmni is
      now set to make the message queues occupy 1/32 of the available lowmem.
      
      Some cleaning has also been done for the MSGPOOL constant: the msgctl man page
      says it's not used, but it also defines it as a size in bytes (the code
      expresses it in Kbytes).
      Signed-off-by: NNadia Derbey <Nadia.Derbey@bull.net>
      Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Cc: Mingming Cao <cmm@us.ibm.com>
      Cc: Pierre Peiffer <pierre.peiffer@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f7bf3df8
    • P
      IPC: use ipc_buildid() directly from ipc_addid() · 48dea404
      Pierre Peiffer 提交于
      By continuing to consolidate a little the IPC code, each id can be built
      directly in ipc_addid() instead of having it built from each callers of
      ipc_addid()
      
      And I also remove shm_addid() in order to have, as much as possible, the
      same code for shm/sem/msg.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: NPierre Peiffer <pierre.peiffer@bull.net>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      48dea404
  12. 09 2月, 2008 3 次提交
    • P
      IPC: consolidate sem_exit_ns(), msg_exit_ns() and shm_exit_ns() · 01b8b07a
      Pierre Peiffer 提交于
      sem_exit_ns(), msg_exit_ns() and shm_exit_ns() are all called when an
      ipc_namespace is released to free all ipcs of each type.  But in fact, they
      do the same thing: they loop around all ipcs to free them individually by
      calling a specific routine.
      
      This patch proposes to consolidate this by introducing a common function,
      free_ipcs(), that do the job.  The specific routine to call on each
      individual ipcs is passed as parameter.  For this, these ipc-specific
      'free' routines are reworked to take a generic 'struct ipc_perm' as
      parameter.
      Signed-off-by: NPierre Peiffer <pierre.peiffer@bull.net>
      Cc: Cedric Le Goater <clg@fr.ibm.com>
      Cc: Pavel Emelyanov <xemul@openvz.org>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      01b8b07a
    • P
      IPC: make struct ipc_ids static in ipc_namespace · ed2ddbf8
      Pierre Peiffer 提交于
      Each ipc_namespace contains a table of 3 pointers to struct ipc_ids (3 for
      msg, sem and shm, structure used to store all ipcs) These 'struct ipc_ids'
      are dynamically allocated for each icp_namespace as the ipc_namespace
      itself (for the init namespace, they are initialized with pointers to
      static variables instead)
      
      It is so for historical reason: in fact, before the use of idr to store the
      ipcs, the ipcs were stored in tables of variable length, depending of the
      maximum number of ipc allowed.  Now, these 'struct ipc_ids' have a fixed
      size.  As they are allocated in any cases for each new ipc_namespace, there
      is no gain of memory in having them allocated separately of the struct
      ipc_namespace.
      
      This patch proposes to make this table static in the struct ipc_namespace.
      Thus, we can allocate all in once and get rid of all the code needed to
      allocate and free these ipc_ids separately.
      Signed-off-by: NPierre Peiffer <pierre.peiffer@bull.net>
      Acked-by: NCedric Le Goater <clg@fr.ibm.com>
      Cc: Pavel Emelyanov <xemul@openvz.org>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ed2ddbf8
    • P
      namespaces: move the IPC namespace under IPC_NS option · ae5e1b22
      Pavel Emelyanov 提交于
      Currently the IPC namespace management code is spread over the ipc/*.c files.
      I moved this code into ipc/namespace.c file which is compiled out when needed.
      
      The linux/ipc_namespace.h file is used to store the prototypes of the
      functions in namespace.c and the stubs for NAMESPACES=n case.  This is done
      so, because the stub for copy_ipc_namespace requires the knowledge of the
      CLONE_NEWIPC flag, which is in sched.h.  But the linux/ipc.h file itself in
      included into many many .c files via the sys.h->sem.h sequence so adding the
      sched.h into it will make all these .c depend on sched.h which is not that
      good.  On the other hand the knowledge about the namespaces stuff is required
      in 4 .c files only.
      
      Besides, this patch compiles out some auxiliary functions from ipc/sem.c,
      msg.c and shm.c files.  It turned out that moving these functions into
      namespaces.c is not that easy because they use many other calls and macros
      from the original file.  Moving them would make this patch complicated.  On
      the other hand all these functions can be consolidated, so I will send a
      separate patch doing this a bit later.
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Acked-by: NSerge Hallyn <serue@us.ibm.com>
      Cc: Cedric Le Goater <clg@fr.ibm.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Herbert Poetzl <herbert@13thfloor.at>
      Cc: Kirill Korotaev <dev@sw.ru>
      Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ae5e1b22
  13. 07 2月, 2008 1 次提交
    • P
      IPC: fix error check in all new xxx_lock() and xxx_exit_ns() functions · b1ed88b4
      Pierre Peiffer 提交于
      In the new implementation of the [sem|shm|msg]_lock[_check]() routines, we
      use the return value of ipc_lock() in container_of() without any check.
      But ipc_lock may return a errcode.  The use of this errcode in
      container_of() may alter this errcode, and we don't want this.
      
      And in xxx_exit_ns, the pointer return by idr_find is of type 'struct
      kern_ipc_per'...
      
      Today, the code will work as is because the member used in these
      container_of() is the first member of its container (offset == 0), the
      errcode isn't changed then.  But in the general case, we can't count on
      this assumption and this may lead later to a real bug if we don't correct
      this.
      
      Again, the proposed solution is simple and correct.  But, as pointed by
      Nadia, with this solution, the same check will be done several times (in
      all sub-callers...), what is not very funny/optimal...
      Signed-off-by: NPierre Peiffer <pierre.peiffer@bull.net>
      Cc: Nadia Derbey <Nadia.Derbey@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b1ed88b4
  14. 20 10月, 2007 10 次提交
  15. 18 7月, 2007 1 次提交
  16. 17 7月, 2007 1 次提交
  17. 08 12月, 2006 1 次提交
    • S
      [PATCH] Fix the size limit of compat space msgsize · 651971cb
      suzuki 提交于
      Currently we allocate 64k space on the user stack and use it the msgbuf for
      sys_{msgrcv,msgsnd} for compat and the results are later copied in user [
      by copy_in_user].  This patch introduces helper routines for
      sys_{msgrcv,msgsnd} as below:
      
      do_msgsnd() : Accepts the mtype and user space ptr to the buffer along with
      the msqid and msgflg.
      
      do_msgrcv() : Accepts a kernel space ptr to mtype and a userspace ptr to
      the buffer.  The mtype has to be copied back the user space msgbuf by the
      caller.
      
      These changes avoid the need to allocate the msgsize on the userspace (
      thus removing the size limt ) and the overhead of an extra copy_in_user().
      Signed-off-by: NSuzuki K P <suzuki@in.ibm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      651971cb