mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nauman Tahir <nauman.tahir@gmail.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, kernelnewbies@nl.kernel.org
Subject: Re: X86_64 and X86_32 bit performance difference [Revisited]
Date: Tue, 10 Jan 2006 02:53:53 -0800	[thread overview]
Message-ID: <f0309ff0601100253k219757b9g5a9030c89235d0f2@mail.gmail.com> (raw)
In-Reply-To: <f0309ff0601100249y4ffa3596sa2a623015cdca66b@mail.gmail.com>

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

On 1/10/06, Nauman Tahir <nauman.tahir@gmail.com> wrote:
> On 1/9/06, Arjan van de Ven <arjan@infradead.org> wrote:
> > On Sun, 2006-01-08 at 22:29 -0800, Nauman Tahir wrote:
> > > Hello All
> > > I have posted this problem before. Now mailing again after testing as
> > > recommeded in previous replys.
> > > My configuration is:
> > >
> > > Hardware:
> > > HP Proliant DL145 (2 x AMD Optaron 144)
> > > 14 GB RAM
> > >
> > > OS:
> > > FC 4
> > >
> > > Kernel
> > > 2.6.xx
> >
> > You *STILL* have not posted the URL to your source code.
> > How is anyone supposed to help you without that?????
>
> I have attached a file which I use as thread API. Complete code is
> quiet large and also need proper description. which i would be posting
> if needed.
> I hope I make my problem clear: I repeat : same code is giving alot of
> performance degradation on previously mentioned configuration. One
> suspect is the thread library.
>
>
> dts_thread_t *dts_register_thread(void (*run) (void *),  const char
> *name, void * private)
>
> is the function to register my thread handler
>
> void dts_wakeup_thread(dts_thread_t *thread)
>
> is the function in the dts_thread.c which i use to run my thread.
>
> all my thread handlers either
> call generic_make_request some times for my RAMDISK and sometimes for
> my Target device [SCSI DISK or local HDD partition]
> OR
> uses list.h
>
>
>
> >
> >
> >
> >
> >
>

[-- Attachment #2: dts_thread.c --]
[-- Type: text/plain, Size: 2475 bytes --]


#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/smp_lock.h>


#include <linux/mempool.h>
#include <linux/slab.h>

#include "../include/dts_thread.h"


#define THREAD_WAKEUP 0x01
extern void dts_set_bit(char * , int );


int dts_thread(void * arg)
{
	dts_thread_t *thread = arg;

	lock_kernel();

	/*
	 * Detach thread
	 */

	daemonize(thread->name);

	current->exit_signal = SIGCHLD;
	allow_signal(SIGKILL);
	thread->tsk = current;

	unlock_kernel();

	complete(thread->event);
	while (thread->run) {
		void (*run)(void *);

		wait_event_interruptible(thread->wqueue,
					 test_bit(THREAD_WAKEUP, &thread->flags));
		if (current->flags & PF_FREEZE)
			refrigerator(PF_FREEZE);

		clear_bit(THREAD_WAKEUP, &thread->flags);

		run = thread->run;
		if (run)
			run(thread->private);

		if (signal_pending(current))
			flush_signals(current);
	}
	complete(thread->event);
	return 0;
}

void dts_wakeup_thread(dts_thread_t *thread)
{
	if (thread) {

		dts_set_bit((char *)&thread->flags, THREAD_WAKEUP);
		wake_up(&thread->wqueue);
	}
	else
	printk("dts_wakeup_thread:.........thread is NULL\n");
}

dts_thread_t *dts_register_thread(void (*run) (void *),  const char *name, void * private)
{
	dts_thread_t *thread=NULL;
	int ret;
	struct completion event;

	thread = (dts_thread_t *) kmalloc
				(sizeof(dts_thread_t), GFP_KERNEL);
	if (!thread)
		return NULL;

	memset(thread, 0, sizeof(dts_thread_t));
	init_waitqueue_head(&thread->wqueue);

	init_completion(&event);
	thread->event = &event;
	thread->run = run;
	thread->name = name;
	thread->private = private;

	ret = kernel_thread(dts_thread, thread, 0);
	if (ret < 0) {
		printk("\ndts_register_thread:.......unable to register kernel thread\n");
		kfree(thread);
		return NULL;
	}
	wait_for_completion(&event);

//	printk("Thread Allocated Successfully\n ");
	return thread;
}

void dts_interrupt_thread(dts_thread_t *thread)
{
	if (!thread->tsk) {
		BUG();
		return;
	}
//	dprintk("interrupting dts-thread pid %d\n", thread->tsk->pid);
	send_sig(SIGKILL, thread->tsk, 1);
}

void dts_unregister_thread(dts_thread_t *thread)
{
	struct completion event;

	init_completion(&event);

	thread->event = &event;
	thread->run = NULL;
	thread->name = NULL;
	dts_interrupt_thread(thread);
	wait_for_completion(&event);
	kfree(thread);
}

EXPORT_SYMBOL(dts_wakeup_thread);
EXPORT_SYMBOL(dts_unregister_thread);
EXPORT_SYMBOL(dts_register_thread);
EXPORT_SYMBOL(dts_interrupt_thread);


  reply	other threads:[~2006-01-10 10:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-09  6:29 Nauman Tahir
2006-01-09  7:51 ` Arjan van de Ven
2006-01-10 10:49   ` Nauman Tahir
2006-01-10 10:53     ` Nauman Tahir [this message]
2006-01-10 21:14     ` Arjan van de Ven
2006-01-09 18:27 ` Andi Kleen
2006-01-10 10:50   ` Nauman Tahir

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=f0309ff0601100253k219757b9g5a9030c89235d0f2@mail.gmail.com \
    --to=nauman.tahir@gmail.com \
    --cc=arjan@infradead.org \
    --cc=kernelnewbies@nl.kernel.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

all inboxes | Powered by JetHome®