From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751508AbdFZLgz (ORCPT ); Mon, 26 Jun 2017 07:36:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:58861 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751422AbdFZLgu (ORCPT ); Mon, 26 Jun 2017 07:36:50 -0400 Date: Mon, 26 Jun 2017 13:36:44 +0200 From: Petr Mladek To: "Luis R. Rodriguez" Cc: akpm@linux-foundation.org, jeyu@redhat.com, shuah@kernel.org, rusty@rustcorp.com.au, ebiederm@xmission.com, dmitry.torokhov@gmail.com, acme@redhat.com, corbet@lwn.net, josh@joshtriplett.org, martin.wilck@suse.com, mmarek@suse.com, hare@suse.com, rwright@hpe.com, jeffm@suse.com, DSterba@suse.com, fdmanana@suse.com, neilb@suse.com, linux@roeck-us.net, rgoldwyn@suse.com, subashab@codeaurora.org, xypron.glpk@gmx.de, keescook@chromium.org, atomlin@redhat.com, mbenes@suse.cz, paulmck@linux.vnet.ibm.com, dan.j.williams@intel.com, jpoimboe@redhat.com, davem@davemloft.net, mingo@redhat.com, alan@linux.intel.com, tytso@mit.edu, gregkh@linuxfoundation.org, torvalds@linux-foundation.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/4] kmod: reduce atomic operations on kmod_concurrent and simplify Message-ID: <20170626113644.GI1538@pathway.suse.cz> References: <20170526001630.19203-1-mcgrof@kernel.org> <20170526211228.27764-1-mcgrof@kernel.org> <20170526211228.27764-3-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170526211228.27764-3-mcgrof@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2017-05-26 14:12:26, Luis R. Rodriguez wrote: > atomic operations. We do this by inverting the logic of of the enabler, > instead of incrementing kmod_concurrent as we get new kmod users, define the > variable kmod_concurrent_max as the max number of currently allowed kmod > users and as we get new kmod users just decrement it if its still positive. > This combines the dec and read in one atomic operation. > > In this case we no longer get the same false failure: > > CPU1 CPU2 > atomic_dec_if_positive() > atomic_dec_if_positive() > atomic_inc() > atomic_inc() > > Suggested-by: Petr Mladek > Suggested-by: Dmitry Torokhov > Signed-off-by: Luis R. Rodriguez The change looks fine to me. The code is much easier and less hacky. Reviewed-by: Petr Mladek Best Regards, Petr