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] [thread-next>] [day] [month] [year] [list]
Message-ID: <4566C519.1090902@openvz.org>
Date:	Fri, 24 Nov 2006 13:10:33 +0300
From:	Pavel Emelianov <xemul@...nvz.org>
To:	Paul Menage <menage@...gle.com>
CC:	Kirill Korotaev <dev@...ru>, Andrew Morton <akpm@...l.org>,
	ckrm-tech@...ts.sourceforge.net,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	matthltc@...ibm.com, hch@...radead.org,
	Alan Cox <alan@...rguk.ukuu.org.uk>, oleg@...sign.ru,
	devel@...nvz.org
Subject: Re: [ckrm-tech] [PATCH 4/13] BC: context handling

I've got it! That's what will work:

struct task_struct {
	...
	struct beancounter *exec_bc;
	struct beancounter *tmp_exec_bc; /* is set to NULL on
                                          * tsk creation
                                          */
};

struct beancounter get_exec_bc(void)
{
	if (current->tmp_exec_bc)
		return current->tmp_exec_bc;
	return rcu_dereference(current->exec_bc);
}


struct beancounter set_tmp_exec_bc(struct beancounter *new)
{
	struct beancounter *old;

	old = current->tmp_exec_bc;
	current->tmp_exec_bc = new;
	return old;
}

void reset_tmp_exec_bc(struct beancounter *expected_old)
{
	BUG_ON(current->tmp_exec_bc != expected_old);
	current->tmp_exec_bc = NULL;
}

void move_task(struct task_struct *tsk, struct beancounter *bc)
{
	struct beancounter *old;

	mutex_lock(&tsk_move_mutex);
	old = tsk->exec_bc;
	get_bc(bc);
	rcu_assign_pointer(current->exec_bc, bc);
	syncronize_rcu();
	mutex_unlock(&tsk_move_mutex);

	bc_put(old);
}

I will implement this in the next beancounter patches.
Thanks for discussion :)
-
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