Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1508388

Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc

From Roman Penyaev <roman.penyaev@profitbricks.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc
Date 2016-10-25 17:50 +0200
Message-ID <swc9c-7vM-3@gated-at.bofh.it> (permalink)
References <sw7Md-4N9-1@gated-at.bofh.it> <swaAq-6ET-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Oct 25, 2016 at 4:03 PM, Oleg Nesterov <oleg@redhat.com> wrote:
> On 10/25, Roman Pen wrote:
>>
>> This patch avoids allocation of kthread structure on a stack, and simply
>> uses kmalloc.
>
> Oh. I didn't even read this patch, but I have to admit I personally do not
> like it. I can be wrong, but imo this is the step to the wrong direction.

it targets only one thing - we can't use stack anymore for keeping kthread
structure on it.  so basically it is not even a step, just an attempt to
fix memory corruption after oops.

> struct kthread is already bloated, we should not bloat it more.

that is clear, but I wanted to keep code simpler with one allocation and
one structure for all the needs.

> Instead we should kill it. And to_kthread() too, at least in its current
> form.

that is nice and this is a step forward, but not with this patch.

>
> For example. parked/exited/cpu should go into smp_hotplug_thread. Yes,
> this needs cleanups.
>
> All we need is kthread_data() which returns the pointer to the private
> data used by kthread.

that means that we still need to store the private data inside task_struct
and probably again abuse some member.

>
> As for kthread_stop(), we no longer need to abuse ->vfork_done, we can
> use task_works:

yes, that can be done easily. in the current patch I already use the
task_work to free the kthread structure. but still for me is not clear
where to keep the private data if you have only task_struct in your
hands.

--
Roman

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 1/1] kthread: allocate kthread structure using kmalloc Roman Pen <roman.penyaev@profitbricks.com> - 2016-10-25 13:10 +0200
  Re: [PATCH v3 1/1] kthread: allocate kthread structure using         kmalloc Oleg Nesterov <oleg@redhat.com> - 2016-10-25 16:10 +0200
    Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc Roman Penyaev <roman.penyaev@profitbricks.com> - 2016-10-25 17:50 +0200
    Re: [PATCH v3 1/1] kthread: allocate kthread structure using         kmalloc Oleg Nesterov <oleg@redhat.com> - 2016-10-25 17:50 +0200
      Re: [PATCH v3 1/1] kthread: allocate kthread structure using         kmalloc Oleg Nesterov <oleg@redhat.com> - 2016-10-25 18:20 +0200
      Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc Roman Penyaev <roman.penyaev@profitbricks.com> - 2016-10-25 18:20 +0200
      Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc Andy Lutomirski <luto@amacapital.net> - 2016-10-25 19:00 +0200
        Re: [PATCH v3 1/1] kthread: allocate kthread structure using kmalloc Oleg Nesterov <oleg@redhat.com> - 2016-10-26 16:20 +0200
          Re: [PATCH v3 1/1] kthread: allocate kthread structure using  kmalloc Thomas Gleixner <tglx@linutronix.de> - 2016-10-26 17:10 +0200
            Re: [PATCH v3 1/1] kthread: allocate kthread structure using         kmalloc Oleg Nesterov <oleg@redhat.com> - 2016-10-26 18:00 +0200
              Re: [PATCH v3 1/1] kthread: allocate kthread structure using  kmalloc Thomas Gleixner <tglx@linutronix.de> - 2016-10-26 20:40 +0200
          Re: [PATCH v3 1/1] kthread: allocate kthread structure using         kmalloc Oleg Nesterov <oleg@redhat.com> - 2016-10-26 18:20 +0200

csiph-web