From: Varsha Rao <rvarsha016@gmail.com>
To: mawilcox@microsoft.com
Cc: outreachy-kernel <outreachy-kernel@googlegroups.com>
Subject: [PATCH v2 1/3] kernel: pid: Update documentation.
Date: Mon, 27 Mar 2017 08:06:38 +0530 [thread overview]
Message-ID: <58d87ab9.5318620a.e4705.ca98@mx.google.com> (raw)
In-Reply-To: <cover.1490581288.git.rvarsha016@gmail.com>
This patch adds comments to update documentation.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
Changes in v2:
- No change.
kernel/pid.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/kernel/pid.c b/kernel/pid.c
index 0143ac0..0b0aad4 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -43,6 +43,7 @@
#define pid_hashfn(nr, ns) \
hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift)
static struct hlist_head *pid_hash;
+/* Doubly linked hash lists to find PID in given namespace. */
static unsigned int pidhash_shift = 4;
struct pid init_struct_pid = INIT_STRUCT_PID;
@@ -53,6 +54,7 @@ int pid_max = PID_MAX_DEFAULT;
int pid_max_min = RESERVED_PIDS + 1;
int pid_max_max = PID_MAX_LIMIT;
+/* mk_pid() returns distance between map and offset pidmap. */
static inline int mk_pid(struct pid_namespace *pid_ns,
struct pidmap *map, int off)
{
@@ -101,6 +103,7 @@ EXPORT_SYMBOL_GPL(init_pid_ns);
static __cacheline_aligned_in_smp DEFINE_SPINLOCK(pidmap_lock);
+/* free_pidmap() : It frees process id. */
static void free_pidmap(struct upid *upid)
{
int nr = upid->nr;
@@ -150,6 +153,9 @@ static void set_last_pid(struct pid_namespace *pid_ns, int base, int pid)
} while ((prev != last_write) && (pid_before(base, last_write, pid)));
}
+/* alloc_pidmap(): Increments last pid by one and returns it if new pid
+ * is valid.
+ */
static int alloc_pidmap(struct pid_namespace *pid_ns)
{
int i, offset, max_scan, pid, last = pid_ns->last_pid;
@@ -212,6 +218,9 @@ static int alloc_pidmap(struct pid_namespace *pid_ns)
return -EAGAIN;
}
+/* next_pidmap() is used to find the first pid which is greater than previous
+ * last allocated pid.
+ */
int next_pidmap(struct pid_namespace *pid_ns, unsigned int last)
{
int offset;
@@ -233,6 +242,7 @@ int next_pidmap(struct pid_namespace *pid_ns, unsigned int last)
return -1;
}
+/* put_pid() checks whether pid can be reallocated. */
void put_pid(struct pid *pid)
{
struct pid_namespace *ns;
@@ -249,6 +259,9 @@ void put_pid(struct pid *pid)
}
EXPORT_SYMBOL_GPL(put_pid);
+/* delayed_put_pid(): Finds the real location of struct pid in the
+ * memory and checks whether it can be reallocated with put_pid().
+ */
static void delayed_put_pid(struct rcu_head *rhp)
{
struct pid *pid = container_of(rhp, struct pid, rcu);
@@ -293,6 +306,9 @@ void free_pid(struct pid *pid)
call_rcu(&pid->rcu, delayed_put_pid);
}
+/* alloc_pid(): Allocates local pid for each multiple namespaces
+ * in which new process created is visible.
+ */
struct pid *alloc_pid(struct pid_namespace *ns)
{
struct pid *pid;
--
2.9.3
next parent reply other threads:[~2017-03-27 2:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1490581288.git.rvarsha016@gmail.com>
2017-03-27 2:36 ` Varsha Rao [this message]
2017-03-27 5:42 ` [Outreachy kernel] [PATCH v2 1/3] kernel: pid: Update documentation Julia Lawall
2017-03-27 5:51 ` Julia Lawall
2017-03-27 15:50 ` Matthew Wilcox
2017-03-27 2:44 ` [PATCH v2 2/3] kernel: pid: Change function return value to bool Varsha Rao
2017-03-27 5:30 ` [Outreachy kernel] " Julia Lawall
2017-03-27 7:54 ` Varsha Rao
2017-03-27 8:04 ` Julia Lawall
2017-03-27 13:47 ` Varsha Rao
2017-03-27 13:56 ` Varsha Rao
2017-03-27 21:48 ` Julia Lawall
2017-03-27 21:35 ` Julia Lawall
2017-03-27 2:45 ` [PATCH v2 3/3] kernel: pid: Add blank line after declarations Varsha Rao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58d87ab9.5318620a.e4705.ca98@mx.google.com \
--to=rvarsha016@gmail.com \
--cc=mawilcox@microsoft.com \
--cc=outreachy-kernel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.