lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <20080801181616.GZ3292@webber.adilger.int>
Date:	Fri, 01 Aug 2008 12:16:16 -0600
From:	Andreas Dilger <adilger@....com>
To:	Josef Bacik <jbacik@...hat.com>
Cc:	Ric Wheeler <rwheeler@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...e.hu>, linux-fsdevel@...r.kernel.org,
	Chris Mason <chris.mason@...cle.com>,
	linux-kernel@...r.kernel.org
Subject: Re: high resolution timers, scheduling & sleep granularity

On Aug 01, 2008  09:25 -0400, Josef Bacik wrote:
> +	if (unlikely(!journal->j_average_commit_time))
> +		journal->j_average_commit_time = commit_time;
> +	else
> +		journal->j_average_commit_time = (commit_time +
> +					journal->j_average_commit_time) / 2;

You may also consider making this a decaying average, so that minor changes
in the workload are smoothed out.  Also, it is probably easier to read
likely(foo) instead of unlikely(!foo)...

	if (likely(journal->j_average_commit_time != 0))
		journal->j_average_commit_time =
			(commit_time * 3 + journal->j_average_commit_time) / 4;
	else
		journal->j_average_commit_time = commit_time;

> +	if (journal->print_count < 100) {
> +		journal->print_count++;
> +		printk(KERN_ERR "avg commit time = %lu\n",
> +		       journal->j_average_commit_time);
> +	}

There is already the jbd stats patch in jbd2 that is reporting this
information for the previous transactions.

>  
> +		spin_lock(&journal->j_state_lock);
> +		commit_time = journal->j_average_commit_time;
> +		spin_unlock(&journal->j_state_lock);
> +
> +		sleep_time = elapsed_jiffies(transaction->t_start_time, jiffies);
> +		if (!sleep_time)
> +			sleep_time = 1;
> +		sleep_time = (commit_time / sleep_time) * commit_time;

I was also going to comment on the use of jiffies here, but Ric beat me
to it.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ