mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: [RFC, PATCH] cond_resched() added to close_files()
Date: Tue, 2 May 2006 21:55:31 +0200	[thread overview]
Message-ID: <200605022155.31990.dada1@cosmosbay.com> (raw)
In-Reply-To: <20060502155244.GA5981@elte.hu>

[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]

When a process exits, it might spend a lot of time in close_files() closing 
thousand of files.

This is bad for latency, and in some cases can trigger 'BUG: soft lockup 
detected on CPU#0!'

Call Trace: <IRQ> <ffffffff8024dafa>{softlockup_tick+250}
       <ffffffff80236cd7>{update_process_times+87} 
<ffffffff80215ed3>{smp_local_timer_interrupt+35}
       <ffffffff80216411>{smp_apic_timer_interrupt+65} 
<ffffffff8020a866>{apic_timer_interrupt+98} <EOI>
       <ffffffff803a7100>{sock_destroy_inode+0} 
<ffffffff803e4b1f>{tcp_send_fin+207}
       <ffffffff803e4ac4>{tcp_send_fin+116} <ffffffff803d988a>{tcp_close+698}
       <ffffffff803f4a07>{inet_release+87} <ffffffff803a84e9>{sock_release+25}
       <ffffffff803a87f5>{sock_close+53} <ffffffff802767a8>{__fput+88}
       <ffffffff8027382d>{filp_close+93} 
<ffffffff8022ee2e>{put_files_struct+110}
       <ffffffff8023025a>{do_exit+650} 
<ffffffff80237bee>{__dequeue_signal+478}
       <ffffffff80230998>{do_group_exit+200} 
<ffffffff80239c6a>{get_signal_to_deliver+1178}
       <ffffffff80209d47>{sysret_signal+28} <ffffffff80209001>{do_signal+129}
       <ffffffff8028d623>{dput+35} <ffffffff803a92db>{sys_accept+443}
       <ffffffff80241eec>{add_wait_queue+28} <ffffffff802ec581>{__up_write+33}
       <ffffffff80209d47>{sysret_signal+28} 
<ffffffff8020a033>{ptregscall_common+103}

This patch makes sure a cond_resched() call is done every 32 (or 64) files 
closed. This also helps reducing number of files waiting in RCU queues for 
final freeing as call_rcu() might have called force_quiescent_state()

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

[-- Attachment #2: close_files.patch --]
[-- Type: text/plain, Size: 524 bytes --]

--- a/kernel/exit.c	2006-05-02 17:31:39.000000000 +0200
+++ b/kernel/exit.c	2006-05-02 17:32:06.000000000 +0200
@@ -445,20 +445,21 @@
 		set = fdt->open_fds->fds_bits[j++];
 		while (set) {
 			if (set & 1) {
 				struct file * file = xchg(&fdt->fd[i], NULL);
 				if (file)
 					filp_close(file, files);
 			}
 			i++;
 			set >>= 1;
 		}
+		cond_resched();
 	}
 }
 
 struct files_struct *get_files_struct(struct task_struct *task)
 {
 	struct files_struct *files;
 
 	task_lock(task);
 	files = task->files;
 	if (files)

  reply	other threads:[~2006-05-02 19:55 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060419112130.GA22648@elte.hu>
2006-04-20  9:18 ` assert/crash in __rmqueue() when enabling CONFIG_NUMA Nick Piggin
2006-04-21 11:20   ` Ingo Molnar
2006-04-21 11:45     ` Ingo Molnar
2006-05-01 12:49       ` Ingo Molnar
2006-05-02  6:48         ` Andi Kleen
2006-05-02  7:06           ` Ingo Molnar
2006-05-02  7:05             ` Andi Kleen
2006-05-02  8:27               ` Ingo Molnar
2006-05-02 14:02               ` Martin J. Bligh
2006-05-02 14:25                 ` Nick Piggin
2006-05-04  1:32                   ` Bob Picco
2006-05-04  8:37                     ` Ingo Molnar
2006-05-04  9:14                       ` Ingo Molnar
2006-05-04  9:26                         ` Ingo Molnar
2006-05-04  8:37                     ` Andy Whitcroft
2006-05-04 15:21                     ` Dave Hansen
2006-05-04 15:46                       ` Bob Picco
2006-05-04 16:07                         ` Dave Hansen
2006-05-04 19:25                         ` Ingo Molnar
2006-05-04 19:43                           ` Bob Picco
2006-05-04 21:50                             ` Andy Whitcroft
2006-05-05  5:17                               ` Ingo Molnar
2006-05-05 13:55                               ` Bob Picco
2006-05-05 14:33                                 ` Dave Hansen
2006-05-05 14:50                                   ` Bob Picco
2006-05-05 14:57                                     ` Dave Hansen
2006-05-05 15:03                                       ` Martin J. Bligh
2006-05-05 16:22                                         ` Bob Picco
2006-05-05 16:18                                       ` Bob Picco
2006-05-06  8:32                                       ` Nick Piggin
2006-05-07 13:07                                         ` Andy Whitcroft
2006-05-07 13:18                                           ` Nick Piggin
2006-05-09 11:05                                             ` [PATCH 0/3] Zone boundry alignment fixes Andy Whitcroft
2006-05-09 11:05                                               ` [PATCH 1/3] zone init check and report unaligned zone boundries Andy Whitcroft
2006-05-09 11:28                                                 ` Nick Piggin
2006-05-09 11:05                                               ` [PATCH 2/3] x86 align highmem zone boundries with NUMA Andy Whitcroft
2006-05-09 11:05                                               ` [PATCH 3/3] zone allow unaligned zone boundries Andy Whitcroft
2006-05-11  7:59                                               ` [PATCH 0/3] Zone boundry alignment fixes Andrew Morton
2006-05-12 14:19                                                 ` Ingo Molnar
2006-05-13  1:39                                                   ` Nick Piggin
2006-05-18 14:20                                                 ` [PATCH 0/2] Zone boundary alignment fixes cleanups Andy Whitcroft
2006-05-18 14:21                                                   ` [PATCH 1/2] zone init check and report unaligned zone boundaries fix Andy Whitcroft
2006-05-18 14:21                                                   ` [PATCH 2/2] zone allow unaligned zone boundaries spelling fix Andy Whitcroft
2006-05-18 14:49                                                     ` Andy Whitcroft
2006-05-18 15:54                                                 ` [PATCH 0/2] Zone boundary alignment fixes, cleanups v2 Andy Whitcroft
2006-05-18 15:55                                                   ` [PATCH 1/2] zone init check and report unaligned zone boundaries fix Andy Whitcroft
2006-05-18 15:55                                                   ` [PATCH 2/2] zone allow unaligned zone boundaries spelling fix Andy Whitcroft
2006-05-02 15:03                 ` assert/crash in __rmqueue() when enabling CONFIG_NUMA Andi Kleen
2006-05-02 15:17                   ` Martin J. Bligh
2006-05-02 15:45                     ` Andi Kleen
2006-05-02 16:02                       ` Martin J. Bligh
2006-05-02 16:05                         ` Andi Kleen
2006-05-02 19:47                         ` Ingo Molnar
2006-05-02 19:48                       ` Ingo Molnar
2006-05-02 19:44                         ` Andi Kleen
2006-05-02 19:56                           ` Martin Bligh
2006-05-02 20:00                             ` Andi Kleen
2006-05-02 20:13                               ` Ingo Molnar
2006-05-02 20:12                                 ` Andi Kleen
2006-05-02 15:52                     ` Ingo Molnar
2006-05-02 19:55                       ` Eric Dumazet [this message]
2006-05-03  7:01                         ` [RFC, PATCH] cond_resched() added to close_files() Ingo Molnar
2006-05-12  9:44                           ` Andrew Morton
2006-05-12 10:20                             ` Ingo Molnar
2006-05-12 12:24                               ` Eric Dumazet
2006-05-14  0:09                               ` Lee Revell
2006-04-21 11:51     ` assert/crash in __rmqueue() when enabling CONFIG_NUMA Nick Piggin

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=200605022155.31990.dada1@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

Powered by JetHome