From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752209AbdK3MUP (ORCPT ); Thu, 30 Nov 2017 07:20:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58512 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750891AbdK3MUO (ORCPT ); Thu, 30 Nov 2017 07:20:14 -0500 From: Giuseppe Scrivano To: Andrew Morton Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, mingo@kernel.org, dave@stgolabs.net Subject: Re: [RFC PATCH] ipc, mqueue: lazy call kern_mount_data in new namespaces References: <20171127125550.15514-1-gscrivan@redhat.com> <20171128135316.6d7bba7fe909ba3d90e318db@linux-foundation.org> <87wp29l6h3.fsf@redhat.com> <20171129141744.5d401ff613116b0bde02cff3@linux-foundation.org> Date: Thu, 30 Nov 2017 13:20:11 +0100 In-Reply-To: <20171129141744.5d401ff613116b0bde02cff3@linux-foundation.org> (Andrew Morton's message of "Wed, 29 Nov 2017 14:17:44 -0800") Message-ID: <87o9nkj6v8.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Nov 2017 12:20:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrew Morton writes: > On Wed, 29 Nov 2017 11:33:28 +0100 Giuseppe Scrivano wrote: > >> Andrew Morton writes: >> >> > OK, but this simply moves the expense so it happens later on. Why is >> > that better? >> >> the optimization is for new IPC namespaces that don't use mq_open. In >> this case there won't be any kern_mount_data cost at all. >> > > Fair enough. Please add this paragraph (or similar) to the changelog: > > : This is a net saving for new IPC namespaces that don't use mq_open(). In > : this case there won't be any kern_mount_data() cost at all > > And.. the patch calls > kern_mount_data()->vfs_kern_mount()->...->kmem_cache_zalloc(GFP_KERNEL) > under spin_lock(). This should have created a might_sleep() warning in > your testing, but obviously did not. > > Could you please find out why? Do you have > CONFIG_DEBUG_ATOMIC_SLEEP=n, I hope? Please peruse > Documentation/process/submit-checklist.rst, section 12... > > I assume a suitable fix would be to create a new mutex (static to > do_mq_open()) to prevent concurrent mounting. thanks for the hints. Indeed, that was a mistake on my side as I didn't use CONFIG_DEBUG_ATOMIC_SLEEP=y. The might_sleep() warning is correctly raised once I enable CONFIG_DEBUG_ATOMIC_SLEEP (and the other options suggested in submit-checklist.rst). Giuseppe