Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751433AbdINAIu (ORCPT ); Wed, 13 Sep 2017 20:08:50 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:44215 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751173AbdINAIt (ORCPT ); Wed, 13 Sep 2017 20:08:49 -0400 X-Google-Smtp-Source: ADKCNb67WMkqDtKjZApLoXlkhIsZLAVY7WXMO9WCR2nEVAA0S/17lNDca8wwBKAJN32q/giTHKj66fYmFbtD8cONmvo= MIME-Version: 1.0 In-Reply-To: <20170913155754.b072c04bbabffab0471a1ee2@linux-foundation.org> References: <20170908223934.67442-1-sherryy@android.com> <20170913215932.86846-1-sherryy@android.com> <20170913150904.90a37a966a04ea394a2c3d9b@linux-foundation.org> <20170913155754.b072c04bbabffab0471a1ee2@linux-foundation.org> From: =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= Date: Wed, 13 Sep 2017 17:08:47 -0700 Message-ID: Subject: Re: [PATCH] mm: Restore mmput_async To: Andrew Morton Cc: Sherry Yang , LKML , Todd Kjos , Martijn Coenen , Greg Kroah-Hartman , Ingo Molnar , Michal Hocko , Vlastimil Babka , David Rientjes , Andrea Arcangeli , Peter Zijlstra , Thomas Gleixner , Andy Lutomirski , Oleg Nesterov , Hoeun Ryu , Christoph Lameter , Vegard Nossum , Frederic Weisbecker Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8E08xEn012441 Content-Length: 1495 Lines: 37 On Wed, Sep 13, 2017 at 3:57 PM, Andrew Morton wrote: > On Wed, 13 Sep 2017 18:44:11 -0400 Sherry Yang wrote: > >> On Wed, Sep 13, 2017 at 6:09 PM, Andrew Morton >> wrote: >> > On Wed, 13 Sep 2017 17:59:27 -0400 Sherry Yang wrote: >> > >> >> Restore asynchronous mmput, allowing mmput_async to be called >> >> from an atomic context in Android binder shrinker callback. >> >> >> >> mmput_async was initially introduced in ec8d7c14e >> >> ("mm, oom_reaper: do not mmput synchronously from the >> >> oom reaper context"), and was removed in 212925802 >> >> ("mm: oom: let oom_reap_task and exit_mmap run concurrently") >> > >> > Presumably there's a patch somewhere which adds a call to mmput_async() >> > into drivers/android/binder.c? Where is that patch? >> >> The patch that uses mmput_async() is >> https://lkml.org/lkml/2017/9/8/785. Gmail doesn't seem to respect >> in-reply-to. > > (Top-posting repaired. Please don't!) > > Is it necessary for binder_alloc_free_page() to take a ref on the mm? > As long as alloc->tsk doesn't exit during binder_alloc_free_page()'s > execution, that task's reference on the mm should be sufficient to keep > the mm alive? > alloc->tsk can exit during binder_alloc_free_page. We don't hold a reference to the task's mm struct while we don't actively use it, as this would prevent the driver from getting closed when a process dies. -- Arve Hjønnevåg