linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Michal Hocko <mhocko@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Huang Ying <ying.huang@linux.intel.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Christoph Hellwig <hch@lst.de>,
	Joel Fernandes <joelaf@google.com>,
	Jisheng Zhang <jszhang@marvell.com>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	John Dias <joaodias@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	LKP <lkp@01.org>
Subject: Re: [PATCH] mm-add-vfree_atomic-fix
Date: Tue, 13 Dec 2016 19:02:23 -0800	[thread overview]
Message-ID: <CALCETrUYdA5Ahr7AwC_uA2vpLasYZeFR2OWWfcv-0AF4CPYceQ@mail.gmail.com> (raw)
In-Reply-To: <3eb4bfa4-ff94-bb5f-095a-3d17d68bf411@virtuozzo.com>

On Tue, Dec 13, 2016 at 11:21 AM, Andrey Ryabinin
<aryabinin@virtuozzo.com> wrote:
> On 12/13/2016 09:15 PM, Andy Lutomirski wrote:
>
>
>>>>
>>>> But not quite acked by me.  What happened to the vfree code that
>>>> causes vfree_deferred to be called in a preemptable context?  That
>>>> sounds like a bug.
>>>
>>> Not sure I understand but the above stack points to a preemptible
>>> context (copy_process). My stack was different and it looks preemptible as well.
>>> free_thread_stack calls vfree_atomic unconditionally. So I am not sure
>>> why do you think this is a bug?
>>>
>>>> (This code doesn't exist in Linus' tree.  What tree does this apply to.)
>>>
>>> Anyway, now that I am looking at Andrew's tree I can see [1] which
>>> doesn't have this_cpu_ptr. So I am not sure where this this_cpu_ptr came
>>> from. Maybe the previous version of the patch which has shown up in the
>>> linux-next and Andrew has picked up [2] in the meantime. /me confused
>>>
>>> [1] http://www.ozlabs.org/~akpm/mmotm/broken-out/mm-add-vfree_atomic.patch
>>> [2] http://lkml.kernel.org/r/1481553981-3856-1-git-send-email-aryabinin@virtuozzo.com
>>
>> The underlying issue seems to be that we have this shiny new function
>> vfree_atomic() which doesn't work in *non-atomic* context and that we
>
> It does work non-atomic context. It's fixed now.
>
>> have "kernel/fork: use vfree_atomic() to free thread stack" that calls
>> vfree_atomic() from non-atomic context.
>
> From both context actually. Usually task stack is freed from atomic context:
>         http://lkml.kernel.org/r/20161019111541.GQ29358@nuc-i3427.alporthouse.com
>         http://lkml.kernel.org/r/CALCETrVqjejgpQVUdem8RK3uxdEgfOZy4cOJqJQjCLtBDnJfyQ@mail.gmail.com
>
> On rare occasions it can be freed from non-atomic context, e.g. error path in copy_process().
>
>> I'm not sure what the motivation of the latter patch was, but ISTM we
>> should revert it.  TBH I'm not quite sure what the purpose of
>> splitting vfree() and vfree_atomic() was, but I'm not seeing any
>> reason that the common case of freeing stacks from non-atomic context
>> should defer the free instead of just doing it right away.
>>
>> Andrey, Johannes, why should task stack freeing use vfree_atomic() in
>> the first place?
>
> Because vfree() now can sleep and task stack freeing usually done in atomic context.
>
>

Fair enough.

-- 
Andy Lutomirski
AMA Capital Management, LLC

  reply	other threads:[~2016-12-14  3:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12  5:35 [lkp-developer] [kernel/fork] cc639db4ac: BUG:using_smp_processor_id()in_preemptible kernel test robot
2016-12-12 14:46 ` [PATCH] mm-add-vfree_atomic-fix Andrey Ryabinin
2016-12-13 10:12   ` Michal Hocko
2016-12-13 16:57     ` Andy Lutomirski
2016-12-13 17:24       ` Michal Hocko
2016-12-13 18:15         ` Andy Lutomirski
2016-12-13 19:21           ` Andrey Ryabinin
2016-12-14  3:02             ` Andy Lutomirski [this message]
2016-12-13 19:06         ` Andrey Ryabinin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALCETrUYdA5Ahr7AwC_uA2vpLasYZeFR2OWWfcv-0AF4CPYceQ@mail.gmail.com \
    --to=luto@amacapital.net \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=hannes@cmpxchg.org \
    --cc=hch@lst.de \
    --cc=hpa@zytor.com \
    --cc=joaodias@google.com \
    --cc=joelaf@google.com \
    --cc=jszhang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=mhocko@kernel.org \
    --cc=mingo@elte.hu \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    --cc=ying.huang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).