All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: "'Andrew Morton'" <akpm@osdl.org>, <zach.brown@oracle.com>
Cc: <linux-aio@kvack.org>, <linux-kernel@vger.kernel.org>,
	"'Benjamin LaHaise'" <bcrl@kvack.org>, <suparna@in.ibm.com>
Subject: [patch] aio: make aio_ring_info->nr_pages an unsigned int
Date: Fri, 29 Dec 2006 19:15:56 -0800	[thread overview]
Message-ID: <000501c72bc0$d286bff0$d634030a@amr.corp.intel.com> (raw)

The number of io_event in AIO event queue allowed currently is no more
than 2^32-1, because the syscall defines:

	asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp)

We internally allocate a ring buffer for nr_events and keeps tracks of
page descriptors for each of these ring buffer pages.  Since page size
is significantly larger than AIO event size (4096 versus 32), I don't
think it is ever possible to overflow nr_pages in 32-bit quantity.

This patch changes nr_pages to unsigned int. on 64-bit arch, changing
it to unsigned int also allows better packing of aio_ring_info structure.


Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>

--- ./include/linux/aio.h.orig	2006-12-24 22:31:55.000000000 -0800
+++ ./include/linux/aio.h	2006-12-24 22:41:28.000000000 -0800
@@ -165,7 +165,7 @@ struct aio_ring_info {
 
 	struct page		**ring_pages;
 	spinlock_t		ring_lock;
-	long			nr_pages;
+	unsigned		nr_pages;
 
 	unsigned		nr, tail;
 

             reply	other threads:[~2006-12-30  3:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-30  3:15 Chen, Kenneth W [this message]
2007-01-03  1:14 ` [patch] aio: make aio_ring_info->nr_pages an unsigned int Zach Brown
2007-01-03  1:23   ` Chen, Kenneth W
2007-01-03  1:25     ` Zach Brown

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='000501c72bc0$d286bff0$d634030a@amr.corp.intel.com' \
    --to=kenneth.w.chen@intel.com \
    --cc=akpm@osdl.org \
    --cc=bcrl@kvack.org \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suparna@in.ibm.com \
    --cc=zach.brown@oracle.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.