Skip to contentSkip to conversation

ipc/mqueue: simplify reading msgqueue limit

PATCH In review Davidlohr Bueso 2 participants 3 messages Nov 3, 2011 – Nov 16, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc/mqueue: simplify reading msgqueue limit

From: Davidlohr Bueso <[email protected]>

Because the current task is being used to get the limit, we can simply use rlimit() instead of task_rlimit().

---
 ipc/mqueue.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
ipc/mqueue.c +1 -2
index 2e0ecfc..c0e4fbb 100644
@@ -127,7 +127,6 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
 
 	if (S_ISREG(mode)) {
 		struct mqueue_inode_info *info;
-		struct task_struct *p = current;
 		unsigned long mq_bytes, mq_msg_tblsz;
 
 		inode->i_fop = &mqueue_file_operations;
@@ -158,7 +157,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
 
 		spin_lock(&mq_lock);
 		if (u->mq_bytes + mq_bytes < u->mq_bytes ||
-		    u->mq_bytes + mq_bytes > task_rlimit(p, RLIMIT_MSGQUEUE)) {
+		    u->mq_bytes + mq_bytes > rlimit(RLIMIT_MSGQUEUE)) {
 			spin_unlock(&mq_lock);
 			/* mqueue_evict_inode() releases info->messages */
 			ret = -EMFILE;
Signature · 1 line
1.7.4.1
#1 lore raw

ping?

Quoted 30 lines · Davidlohr Bueso

From: Davidlohr Bueso <[email protected]>

Because the current task is being used to get the limit, we can simply use rlimit() instead of task_rlimit().

---
 ipc/mqueue.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
ipc/mqueue.c +1 -2
index 2e0ecfc..c0e4fbb 100644
@@ -127,7 +127,6 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
 
 	if (S_ISREG(mode)) {
 		struct mqueue_inode_info *info;
-		struct task_struct *p = current;
 		unsigned long mq_bytes, mq_msg_tblsz;
 
 		inode->i_fop = &mqueue_file_operations;
@@ -158,7 +157,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
 
 		spin_lock(&mq_lock);
 		if (u->mq_bytes + mq_bytes < u->mq_bytes ||
-		    u->mq_bytes + mq_bytes > task_rlimit(p, RLIMIT_MSGQUEUE)) {
+		    u->mq_bytes + mq_bytes > rlimit(RLIMIT_MSGQUEUE)) {
 			spin_unlock(&mq_lock);
 			/* mqueue_evict_inode() releases info->messages */
 			ret = -EMFILE;
#2 lore raw
Quoted 8 lines · Davidlohr Bueso

ping?

Quoted 5 lines · Davidlohr Bueso

From: Davidlohr Bueso <[email protected]>

Because the current task is being used to get the limit, we can simply use rlimit() instead of task_rlimit().

Sorry for the delay.

Quoted 33 lines
Quoted 17 lines
---
 ipc/mqueue.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
ipc/mqueue.c +0 -1
index 2e0ecfc..c0e4fbb 100644
@@ -127,7 +127,6 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
 
 	if (S_ISREG(mode)) {
 		struct mqueue_inode_info *info;
-		struct task_struct *p = current;
 		unsigned long mq_bytes, mq_msg_tblsz;
 
 		inode->i_fop = &mqueue_file_operations;

ipc/mqueue.c static struct inode *mqueue_get_inode(struct super_block *sb, · line 163

Quoted 8 lines
ipc/mqueue.c +1 -1
@@ -158,7 +157,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
 
 		spin_lock(&mq_lock);
 		if (u->mq_bytes + mq_bytes < u->mq_bytes ||
-		    u->mq_bytes + mq_bytes > task_rlimit(p, RLIMIT_MSGQUEUE)) {
+		    u->mq_bytes + mq_bytes > rlimit(RLIMIT_MSGQUEUE)) {
 			spin_unlock(&mq_lock);
 			/* mqueue_evict_inode() releases info->messages */
 			ret = -EMFILE;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/