Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942115AbcJYWa7 (ORCPT ); Tue, 25 Oct 2016 18:30:59 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:34227 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941746AbcJYWa5 (ORCPT ); Tue, 25 Oct 2016 18:30:57 -0400 Date: Tue, 25 Oct 2016 15:30:54 -0700 From: Dmitry Torokhov To: LKML Cc: Peter Zijlstra , Tejun Heo , computersforpeace@gmail.com Subject: complete_all and "forever" completions Message-ID: <20161025223054.GA22917@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Content-Length: 782 Lines: 23 Hi, Reading Documentation/scheduler/completion.txt, complete_all() is supposed to be usable with "forever" completions, i.e. when we have an action that happens once and stays "done" for the rest of lifetime of an object, no matter how many times we check for "doneness". However the implementation for complete_all() simply sets the counter to be greater or equal UINT_MAX/2 and do_wait_for_common() happily decreases it on every call. Is it simply an artefact of [older] implementation where we do not expect to make that many calls to wait_for_completion*() so that completion that is signalled with ocmplete_all() is practically stays signalled forever? Or do we need something like this in do_wait_for_common(): if (x->done < UINT_MAX/2) x->done--; Thanks. -- Dmitry