Re: linux-next: manual merge of the cgroup tree with the net-next tree

2017-11-12 Thread Stephen Rothwell
Hi Mark,

On Mon, 9 Oct 2017 19:38:36 +0100 Mark Brown  wrote:
>
> Hi Tejun,
> 
> Today's linux-next merge of the cgroup tree got a conflict in:
> 
>   kernel/cgroup/cgroup.c
> 
> between commit:
> 
>   324bda9e6c5ad ("bpf: multi program support for cgroup+bpf")
> 
> from the net-next tree and commit:
> 
>   041cd640b2f3c ("cgroup: Implement cgroup2 basic CPU usage accounting")
> 
> from the cgroup tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> diff --cc kernel/cgroup/cgroup.c
> index 00f5b358aeac,c3421ee0d230..
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@@ -4765,8 -4785,9 +4788,11 @@@ static struct cgroup *cgroup_create(str
>   
>   return cgrp;
>   
>  +out_idr_free:
>  +cgroup_idr_remove(>cgroup_idr, cgrp->id);
> + out_stat_exit:
> + if (cgroup_on_dfl(parent))
> + cgroup_stat_exit(cgrp);
>   out_cancel_ref:
>   percpu_ref_exit(>self.refcnt);
>   out_free_cgrp:

Just a reminder that this conflict still exists.

-- 
Cheers,
Stephen Rothwell


Re: linux-next: manual merge of the cgroup tree with the net-next tree

2017-10-09 Thread Alexei Starovoitov
On Mon, Oct 09, 2017 at 07:38:36PM +0100, Mark Brown wrote:
> Hi Tejun,
> 
> Today's linux-next merge of the cgroup tree got a conflict in:
> 
>   kernel/cgroup/cgroup.c
> 
> between commit:
> 
>   324bda9e6c5ad ("bpf: multi program support for cgroup+bpf")
> 
> from the net-next tree and commit:
> 
>   041cd640b2f3c ("cgroup: Implement cgroup2 basic CPU usage accounting")
> 
> from the cgroup tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> diff --cc kernel/cgroup/cgroup.c
> index 00f5b358aeac,c3421ee0d230..
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@@ -4765,8 -4785,9 +4788,11 @@@ static struct cgroup *cgroup_create(str
>   
>   return cgrp;
>   
>  +out_idr_free:
>  +cgroup_idr_remove(>cgroup_idr, cgrp->id);
> + out_stat_exit:
> + if (cgroup_on_dfl(parent))
> + cgroup_stat_exit(cgrp);

thanks. I did the same merge conflict resolution for our combined tree.



linux-next: manual merge of the cgroup tree with the net-next tree

2017-10-09 Thread Mark Brown
Hi Tejun,

Today's linux-next merge of the cgroup tree got a conflict in:

  kernel/cgroup/cgroup.c

between commit:

  324bda9e6c5ad ("bpf: multi program support for cgroup+bpf")

from the net-next tree and commit:

  041cd640b2f3c ("cgroup: Implement cgroup2 basic CPU usage accounting")

from the cgroup tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc kernel/cgroup/cgroup.c
index 00f5b358aeac,c3421ee0d230..
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@@ -4765,8 -4785,9 +4788,11 @@@ static struct cgroup *cgroup_create(str
  
return cgrp;
  
 +out_idr_free:
 +  cgroup_idr_remove(>cgroup_idr, cgrp->id);
+ out_stat_exit:
+   if (cgroup_on_dfl(parent))
+   cgroup_stat_exit(cgrp);
  out_cancel_ref:
percpu_ref_exit(>self.refcnt);
  out_free_cgrp:


signature.asc
Description: PGP signature


linux-next: manual merge of the cgroup tree with the net-next tree

2016-07-20 Thread Stephen Rothwell
Hi Tejun,

Today's linux-next merge of the cgroup tree got a conflict in:

  kernel/cgroup.c

between commit:

  1f3fe7ebf613 ("cgroup: Add cgroup_get_from_fd")

from the net-next tree and commit:

  55094f575358 ("cgroup: remove duplicated include from cgroup.c")

from the cgroup tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc kernel/cgroup.c
index 50787cd61da2,cb7cc54e2716..
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@@ -61,8 -61,6 +61,7 @@@
  #include 
  #include 
  #include 
- #include 
 +#include 
  #include 
  
  /*


linux-next: manual merge of the cgroup tree with the net-next tree

2015-12-31 Thread Stephen Rothwell
Hi Tejun,

Today's linux-next merge of the cgroup tree got a conflict in:

  include/linux/cgroup.h
  kernel/cgroup.c

between commit:

  bd1060a1d671 ("sock, cgroup: add sock->sk_cgroup")

from the net-next tree and commit:

  f176ae3a5df6 ("cgroup: introduce cgroup namespaces")

from the cgroup tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc include/linux/cgroup.h
index 322a28482745,6d0992f3543d..
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@@ -577,45 -569,47 +569,88 @@@ static inline int cgroup_init(void) { r
  
  #endif /* !CONFIG_CGROUPS */
  
 +/*
 + * sock->sk_cgrp_data handling.  For more info, see sock_cgroup_data
 + * definition in cgroup-defs.h.
 + */
 +#ifdef CONFIG_SOCK_CGROUP_DATA
 +
 +#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
 +extern spinlock_t cgroup_sk_update_lock;
 +#endif
 +
 +void cgroup_sk_alloc_disable(void);
 +void cgroup_sk_alloc(struct sock_cgroup_data *skcd);
 +void cgroup_sk_free(struct sock_cgroup_data *skcd);
 +
 +static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd)
 +{
 +#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
 +  unsigned long v;
 +
 +  /*
 +   * @skcd->val is 64bit but the following is safe on 32bit too as we
 +   * just need the lower ulong to be written and read atomically.
 +   */
 +  v = READ_ONCE(skcd->val);
 +
 +  if (v & 1)
 +  return _dfl_root.cgrp;
 +
 +  return (struct cgroup *)(unsigned long)v ?: _dfl_root.cgrp;
 +#else
 +  return (struct cgroup *)(unsigned long)skcd->val;
 +#endif
 +}
 +
 +#else /* CONFIG_CGROUP_DATA */
 +
 +static inline void cgroup_sk_alloc(struct sock_cgroup_data *skcd) {}
 +static inline void cgroup_sk_free(struct sock_cgroup_data *skcd) {}
 +
 +#endif/* CONFIG_CGROUP_DATA */
 +
+ struct cgroup_namespace {
+   atomic_tcount;
+   struct ns_commonns;
+   struct user_namespace   *user_ns;
+   struct css_set  *root_cset;
+ };
+ 
+ extern struct cgroup_namespace init_cgroup_ns;
+ 
+ #ifdef CONFIG_CGROUPS
+ 
+ void free_cgroup_ns(struct cgroup_namespace *ns);
+ 
+ struct cgroup_namespace *
+ copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
+  struct cgroup_namespace *old_ns);
+ 
+ char *cgroup_path(struct cgroup *cgrp, char *buf, size_t buflen);
+ 
+ #else /* !CONFIG_CGROUPS */
+ 
+ static inline void free_cgroup_ns(struct cgroup_namespace *ns) { }
+ static inline struct cgroup_namespace *
+ copy_cgroup_ns(unsigned long flags, struct user_namespace *user_ns,
+  struct cgroup_namespace *old_ns)
+ {
+   return old_ns;
+ }
+ 
+ #endif /* !CONFIG_CGROUPS */
+ 
+ static inline void get_cgroup_ns(struct cgroup_namespace *ns)
+ {
+   if (ns)
+   atomic_inc(>count);
+ }
+ 
+ static inline void put_cgroup_ns(struct cgroup_namespace *ns)
+ {
+   if (ns && atomic_dec_and_test(>count))
+   free_cgroup_ns(ns);
+ }
+ 
  #endif /* _LINUX_CGROUP_H */
diff --cc kernel/cgroup.c
index fe95970b1f79,7eb1d9de2afa..
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@@ -57,8 -57,11 +57,12 @@@
  #include  /* TODO: replace with more sophisticated array */
  #include 
  #include 
+ #include 
+ #include 
+ #include 
+ 
  #include 
 +#include 
  
  /*
   * pidlists linger the following amount before being destroyed.  The goal
@@@ -5839,59 -5900,134 +5901,187 @@@ struct cgroup *cgroup_get_from_path(con
  }
  EXPORT_SYMBOL_GPL(cgroup_get_from_path);
  
 +/*
 + * sock->sk_cgrp_data handling.  For more info, see sock_cgroup_data
 + * definition in cgroup-defs.h.
 + */
 +#ifdef CONFIG_SOCK_CGROUP_DATA
 +
 +#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID)
 +
 +DEFINE_SPINLOCK(cgroup_sk_update_lock);
 +static bool cgroup_sk_alloc_disabled __read_mostly;
 +
 +void cgroup_sk_alloc_disable(void)
 +{
 +  if (cgroup_sk_alloc_disabled)
 +  return;
 +  pr_info("cgroup: disabling cgroup2 socket matching due to net_prio or 
net_cls activation\n");
 +  cgroup_sk_alloc_disabled = true;
 +}
 +
 +#else
 +
 +#define cgroup_sk_alloc_disabled  false
 +
 +#endif
 +
 +void cgroup_sk_alloc(struct sock_cgroup_data *skcd)
 +{
 +  if (cgroup_sk_alloc_disabled)
 +  return;
 +
 +  rcu_read_lock();
 +
 +  while (true) {
 +  struct css_set *cset;
 +
 +  cset = task_css_set(current);
 +  if (likely(cgroup_tryget(cset->dfl_cgrp))) {
 +  skcd->val = (unsigned long)cset->dfl_cgrp;
 +  break;
 +  }
 +  cpu_relax();
 +  }
 +
 +  rcu_read_unlock();
 +}
 +
 +void cgroup_sk_free(struct sock_cgroup_data *skcd)
 +{
 +  cgroup_put(sock_cgroup_ptr(skcd));
 +}
 +
 +#endif/* CONFIG_SOCK_CGROUP_DATA */
 +