public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2/2] conditionally reschedule in hashtab_insert while loading selinux policy.
@ 2014-05-15 19:03 Dave Jones
  2014-05-15 19:18 ` Stephen Smalley
  2014-05-15 21:15 ` Paul Moore
  0 siblings, 2 replies; 3+ messages in thread
From: Dave Jones @ 2014-05-15 19:03 UTC (permalink / raw)
  To: Linux Kernel; +Cc: sds, pmoore, eparis

After silencing the sleeping warning in mls_convert_context() I started
seeing similar traces from hashtab_insert. Do a cond_resched there too.

Signed-off-by: Dave Jones <davej@redhat.com>

diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c
index 933e735bb185..2cc496149842 100644
--- a/security/selinux/ss/hashtab.c
+++ b/security/selinux/ss/hashtab.c
@@ -6,6 +6,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/errno.h>
+#include <linux/sched.h>
 #include "hashtab.h"
 
 struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
@@ -40,6 +41,8 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)
 	u32 hvalue;
 	struct hashtab_node *prev, *cur, *newnode;
 
+	cond_resched();
+
 	if (!h || h->nel == HASHTAB_MAX_NODES)
 		return -EINVAL;
 
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [2/2] conditionally reschedule in hashtab_insert while loading selinux policy.
  2014-05-15 19:03 [2/2] conditionally reschedule in hashtab_insert while loading selinux policy Dave Jones
@ 2014-05-15 19:18 ` Stephen Smalley
  2014-05-15 21:15 ` Paul Moore
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Smalley @ 2014-05-15 19:18 UTC (permalink / raw)
  To: Dave Jones, Linux Kernel, pmoore, eparis

On 05/15/2014 03:03 PM, Dave Jones wrote:
> After silencing the sleeping warning in mls_convert_context() I started
> seeing similar traces from hashtab_insert. Do a cond_resched there too.
> 
> Signed-off-by: Dave Jones <davej@redhat.com>

Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>

> 
> diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c
> index 933e735bb185..2cc496149842 100644
> --- a/security/selinux/ss/hashtab.c
> +++ b/security/selinux/ss/hashtab.c
> @@ -6,6 +6,7 @@
>  #include <linux/kernel.h>
>  #include <linux/slab.h>
>  #include <linux/errno.h>
> +#include <linux/sched.h>
>  #include "hashtab.h"
>  
>  struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
> @@ -40,6 +41,8 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)
>  	u32 hvalue;
>  	struct hashtab_node *prev, *cur, *newnode;
>  
> +	cond_resched();
> +
>  	if (!h || h->nel == HASHTAB_MAX_NODES)
>  		return -EINVAL;
>  
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [2/2] conditionally reschedule in hashtab_insert while loading selinux policy.
  2014-05-15 19:03 [2/2] conditionally reschedule in hashtab_insert while loading selinux policy Dave Jones
  2014-05-15 19:18 ` Stephen Smalley
@ 2014-05-15 21:15 ` Paul Moore
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Moore @ 2014-05-15 21:15 UTC (permalink / raw)
  To: Dave Jones; +Cc: Linux Kernel, sds, eparis

On Thursday, May 15, 2014 03:03:53 PM Dave Jones wrote:
> After silencing the sleeping warning in mls_convert_context() I started
> seeing similar traces from hashtab_insert. Do a cond_resched there too.
> 
> Signed-off-by: Dave Jones <davej@redhat.com>

Merged to the SELinux #next branch, thanks.

> diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c
> index 933e735bb185..2cc496149842 100644
> --- a/security/selinux/ss/hashtab.c
> +++ b/security/selinux/ss/hashtab.c
> @@ -6,6 +6,7 @@
>  #include <linux/kernel.h>
>  #include <linux/slab.h>
>  #include <linux/errno.h>
> +#include <linux/sched.h>
>  #include "hashtab.h"
> 
>  struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const
> void *key), @@ -40,6 +41,8 @@ int hashtab_insert(struct hashtab *h, void
> *key, void *datum) u32 hvalue;
>  	struct hashtab_node *prev, *cur, *newnode;
> 
> +	cond_resched();
> +
>  	if (!h || h->nel == HASHTAB_MAX_NODES)
>  		return -EINVAL;

-- 
paul moore
security and virtualization @ redhat


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-15 21:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-15 19:03 [2/2] conditionally reschedule in hashtab_insert while loading selinux policy Dave Jones
2014-05-15 19:18 ` Stephen Smalley
2014-05-15 21:15 ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox