Re: X86_64 and X86_32 bit performance difference [Revisited]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/10/06, Nauman Tahir <[email protected]> wrote:
> On 1/9/06, Arjan van de Ven <[email protected]> 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
>
>
>
> >
> >
> >
> >
> >
>
#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);


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux