From: Eric Dumazet <dada1@cosmosbay.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] eventpoll : Suppress a short lived lock from struct file
Date: Mon, 11 Jul 2005 09:18:27 +0200 [thread overview]
Message-ID: <42D21D43.3060300@cosmosbay.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0504172159120.28447@bigblue.dev.mdolabs.com>
[-- Attachment #1: Type: text/plain, Size: 448 bytes --]
Hi Davide
I found in my tests that there is no need to have a f_ep_lock spinlock
attached to each struct file, using 8 bytes on 64bits platforms. The
lock is hold for a very short time period and can be global, with almost
no change in performance for applications using epoll, and a gain for
all others.
Thank you
Eric Dumazet
[PATCH] eventpoll : Suppress a short lived lock from struct file
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
[-- Attachment #2: patch_eventpoll --]
[-- Type: text/plain, Size: 1856 bytes --]
--- linux-2.6.12/fs/eventpoll.c 2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.12-ed/fs/eventpoll.c 2005-07-11 08:56:07.000000000 +0200
@@ -179,6 +179,8 @@
spinlock_t lock;
};
+static DEFINE_SPINLOCK(f_ep_lock);
+
/*
* This structure is stored inside the "private_data" member of the file
* structure and rapresent the main data sructure for the eventpoll
@@ -426,7 +428,6 @@
{
INIT_LIST_HEAD(&file->f_ep_links);
- spin_lock_init(&file->f_ep_lock);
}
@@ -967,9 +968,9 @@
goto eexit_2;
/* Add the current item to the list of active epoll hook for this file */
- spin_lock(&tfile->f_ep_lock);
+ spin_lock(&f_ep_lock);
list_add_tail(&epi->fllink, &tfile->f_ep_links);
- spin_unlock(&tfile->f_ep_lock);
+ spin_unlock(&f_ep_lock);
/* We have to drop the new item inside our item list to keep track of it */
write_lock_irqsave(&ep->lock, flags);
@@ -1160,7 +1161,6 @@
{
int error;
unsigned long flags;
- struct file *file = epi->ffd.file;
/*
* Removes poll wait queue hooks. We _have_ to do this without holding
@@ -1173,10 +1173,10 @@
ep_unregister_pollwait(ep, epi);
/* Remove the current item from the list of epoll hooks */
- spin_lock(&file->f_ep_lock);
+ spin_lock(&f_ep_lock);
if (EP_IS_LINKED(&epi->fllink))
EP_LIST_DEL(&epi->fllink);
- spin_unlock(&file->f_ep_lock);
+ spin_unlock(&f_ep_lock);
/* We need to acquire the write IRQ lock before calling ep_unlink() */
write_lock_irqsave(&ep->lock, flags);
--- linux-2.6.12/include/linux/fs.h 2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.12-ed/include/linux/fs.h 2005-07-11 08:58:02.000000000 +0200
@@ -597,7 +597,6 @@
#ifdef CONFIG_EPOLL
/* Used by fs/eventpoll.c to link all the hooks to this file */
struct list_head f_ep_links;
- spinlock_t f_ep_lock;
#endif /* #ifdef CONFIG_EPOLL */
struct address_space *f_mapping;
};
next prev parent reply other threads:[~2005-07-11 7:18 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-18 3:19 [PATCH x86_64] Live Patching Function on 2.6.11.7 Takashi Ikebe
2005-04-18 4:07 ` Chris Wedgwood
2005-04-18 4:19 ` Takashi Ikebe
2005-04-18 4:42 ` Daniel Jacobowitz
2005-04-18 4:55 ` Nicholas Miell
2005-04-18 5:01 ` Davide Libenzi
2005-04-18 5:41 ` Takashi Ikebe
2005-07-11 7:18 ` Eric Dumazet [this message]
2005-07-11 8:34 ` [PATCH] eventpoll : Suppress a short lived lock from struct file Peter Zijlstra
2005-07-11 9:29 ` Eric Dumazet
2005-07-11 14:00 ` Davide Libenzi
2005-07-11 15:20 ` Eric Dumazet
2005-04-18 5:00 ` [PATCH x86_64] Live Patching Function on 2.6.11.7 David S. Miller
2005-04-18 6:12 ` Chris Wedgwood
2005-04-18 6:35 ` Chris Friesen
2005-04-18 6:48 ` Chris Wedgwood
2005-04-18 10:03 ` James Courtier-Dutton
2005-04-18 9:10 ` Chris Wedgwood
2005-04-18 7:32 ` Takashi Ikebe
2005-04-18 7:56 ` Chris Wedgwood
2005-04-18 8:37 ` Takashi Ikebe
2005-04-18 8:59 ` Chris Wedgwood
2005-04-18 9:16 ` Paul Jackson
2005-04-18 9:25 ` Chris Wedgwood
2005-04-18 11:30 ` Rik van Riel
2005-04-18 12:52 ` Takashi Ikebe
2005-04-18 14:06 ` Rik van Riel
2005-04-19 2:14 ` Takashi Ikebe
2005-04-19 4:27 ` Chris Wedgwood
2005-04-19 5:19 ` Takashi Ikebe
2005-04-19 5:52 ` Chris Wedgwood
2005-04-20 4:18 ` Takashi Ikebe
2005-04-20 5:43 ` Chris Wedgwood
2005-04-20 7:35 ` Takashi Ikebe
2005-04-20 7:50 ` Chris Wedgwood
2005-04-20 7:57 ` Takashi Ikebe
2005-04-20 8:26 ` Chris Wedgwood
2005-04-20 8:45 ` Takashi Ikebe
2005-04-20 8:51 ` Chris Wedgwood
2005-04-20 11:19 ` Rik van Riel
2005-04-20 15:06 ` Chris Friesen
2005-04-20 8:34 ` Miquel van Smoorenburg
2005-04-19 5:57 ` Takashi Ikebe
2005-04-18 14:28 ` Paul Jackson
2005-04-20 13:10 ` Ralf Baechle
2005-04-20 15:08 ` Chris Friesen
2005-04-23 16:17 ` Andi Kleen
2005-04-25 2:11 ` Takashi Ikebe
2005-04-25 2:48 ` Kyle Moffett
2005-04-25 10:39 ` Takashi Ikebe
2005-04-25 11:15 ` Kyle Moffett
2005-04-25 15:09 ` Pavel Machek
2005-04-25 15:54 ` Andi Kleen
2005-04-25 16:36 ` Valdis.Kletnieks
2005-04-26 1:34 ` Takashi Ikebe
2005-04-26 2:15 ` Kyle Moffett
2005-04-26 9:36 ` Pavel Machek
2005-04-26 13:05 ` Andi Kleen
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=42D21D43.3060300@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox