Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755003AbdDNUiA (ORCPT ); Fri, 14 Apr 2017 16:38:00 -0400 Received: from resqmta-ch2-10v.sys.comcast.net ([69.252.207.42]:55570 "EHLO resqmta-ch2-10v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752365AbdDNUh6 (ORCPT ); Fri, 14 Apr 2017 16:37:58 -0400 Date: Fri, 14 Apr 2017 15:37:54 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Vlastimil Babka cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Li Zefan , Michal Hocko , Mel Gorman , David Rientjes , Hugh Dickins , Andrea Arcangeli , Anshuman Khandual , "Kirill A. Shutemov" , linux-api@vger.kernel.org Subject: Re: [RFC 1/6] mm, page_alloc: fix more premature OOM due to race with cpuset update In-Reply-To: Message-ID: References: <20170411140609.3787-1-vbabka@suse.cz> <20170411140609.3787-2-vbabka@suse.cz> Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfDdf8yMIgbR7nxvJ+etX6i5k3+4asJ7cAPuJlWabEnRVUrTJNGZDUxDvkbxS+lSZrRGwmkq6IFq9QnnexMMO9T/3OzPSPdOAR2XF3ByAXKhPvdRaJG7Q RNH/4GAmT1h5Rc9n6ZbtB+Vx/pjOu6Ls9ojxsj7NFP7NWbkf3hxkXG8PFJ9VQEmUoSwmxHj/TV1vxehx7Kku3q/ovmRVK+CVIhC+Fr5Sc9OaEetI9kFzvaK/ LpfiHjNMXInDsQ9mQ8A+d4PTP4kTtKrD/AQcxFVuiDA4yk3FTbET89QEntds8EWejW3AJ+/hl7R0Fs7dXZZwRQEMz3PLxHcADdsmcYdYr/c2Hkayg4K2V4Sp YEm5I+dY+UYEganncJEgjsEQIjJIU2NlYL+0ZtZoZRgR9fcfXr0zIwJ0EmM18CO7dP7IFY2npKFVDG9G55Ygk8cd5KAIyInl0dew8+zv2FR4LkSgjb4SKJ0O EOv85P2DL3UgvRKzi32Cj4oRXEJwRqoI+uBd8kBW67d4EiVtxdk0EJPe/uWtDdYferXgSGuXFEfeQNWWEP2O/MAjNHwZiiu4RmSDTw== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2043 Lines: 49 On Thu, 13 Apr 2017, Vlastimil Babka wrote: > > I doubt we can change that now, because that can break existing > programs. It also makes some sense at least to me, because a task can > control its own mempolicy (for performance reasons), but cpuset changes > are admin decisions that the task cannot even anticipate. I think it's > better to continue working with suboptimal performance than start > failing allocations? If the expected semantics (hardwall) are that allocations should fail then lets be consistent and do so. Adding more and more exceptions gets this convoluted mess into an even worse shape. Adding the static binding of nodes was already a screwball if used within a cpuset because now one has to anticipate how a user would move the nodes of a cpuset and how the static bindings would work in such a context. The admin basically needs to know how the application has used memory policies if one still wants to move the applications within a cpuset with the fixed bindings. Maybe the best way to handle this is to give up on cpuset migration of live applications? After all this can be done with a script in the same way as the kernel is doing: 1. Extend the cpuset to include the new nodes. 2. Loop over the processes and use the migrate_pages() to move the apps one by one. 3. Remove the nodes no longer to be used. Then forget about translating memory policies. If an application that is supposed to run in a cpuset and supposed to be moveable has fixed bindings then the application should be aware of that and be equipped with some logic to rebind its memory on its own. Such an application typically already has such logic and executes a binding after discovering its numa node configuration on startup. It would have to be modified to redo that action when it gets some sort of a signal from the script telling it that the node config would be changed. Having this logic in the application instead of the kernel avoids all the kernel messes that we keep on trying to deal with and IMHO is much cleaner.