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]
Date:	Thu, 29 Nov 2012 08:14:13 +0200
From:	"Kirill A. Shutemov" <kirill@...temov.name>
To:	Anton Vorontsov <anton.vorontsov@...aro.org>
Cc:	David Rientjes <rientjes@...gle.com>,
	Pekka Enberg <penberg@...nel.org>,
	Mel Gorman <mgorman@...e.de>,
	Glauber Costa <glommer@...allels.com>,
	Michal Hocko <mhocko@...e.cz>,
	Luiz Capitulino <lcapitulino@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Greg Thelen <gthelen@...gle.com>,
	Leonid Moiseichuk <leonid.moiseichuk@...ia.com>,
	KOSAKI Motohiro <kosaki.motohiro@...il.com>,
	Minchan Kim <minchan@...nel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
	John Stultz <john.stultz@...aro.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, linaro-kernel@...ts.linaro.org,
	patches@...aro.org, kernel-team@...roid.com
Subject: Re: [RFC] Add mempressure cgroup

On Wed, Nov 28, 2012 at 02:29:08AM -0800, Anton Vorontsov wrote:
> +static int mpc_pre_destroy(struct cgroup *cg)
> +{
> +	struct mpc_state *mpc = cg2mpc(cg);
> +	int ret = 0;
> +
> +	mutex_lock(&mpc->lock);
> +
> +	if (mpc->eventfd)
> +		ret = -EBUSY;

cgroup_rmdir() will unregister all events for you. No need to handle it
here.

> +
> +	mutex_unlock(&mpc->lock);
> +
> +	return ret;
> +}

> +static int mpc_register_level_event(struct cgroup *cg, struct cftype *cft,
> +				    struct eventfd_ctx *eventfd,
> +				    const char *args)
> +{
> +	struct mpc_state *mpc = cg2mpc(cg);
> +	int i;
> +	int ret;
> +
> +	mutex_lock(&mpc->lock);
> +
> +	/*
> +	 * It's easy to implement multiple thresholds, but so far we don't
> +	 * need it.
> +	 */
> +	if (mpc->eventfd) {
> +		ret = -EBUSY;
> +		goto out_unlock;
> +	}

One user which listen for one threashold per cgroup?
I think it's wrong. It's essensial for API to serve multiple users.

> +
> +	ret = -EINVAL;
> +	for (i = 0; i < VMPRESSURE_NUM_LEVELS; i++) {
> +		if (strcmp(vmpressure_str_levels[i], args))
> +			continue;
> +		mpc->eventfd = eventfd;
> +		mpc->thres = i;
> +		ret = 0;
> +		break;
> +	}
> +out_unlock:
> +	mutex_unlock(&mpc->lock);
> +
> +	return ret;
> +}

-- 
 Kirill A. Shutemov
--
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