Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752989AbdFMKcc (ORCPT ); Tue, 13 Jun 2017 06:32:32 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36191 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752140AbdFMKc2 (ORCPT ); Tue, 13 Jun 2017 06:32:28 -0400 Date: Tue, 13 Jun 2017 13:32:25 +0300 From: Cyrill Gorcunov To: Kirill Tkhai Cc: avagin@openvz.org, linux-kernel@vger.kernel.org, bcrl@kvack.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, xemul@virtuozzo.com Subject: Re: [PATCH] aio: Add command to wait completion of all requests Message-ID: <20170613103225.GB23987@uranus.lan> References: <149700173837.15252.8419518498235874341.stgit@localhost.localdomain> <20170613081412.GA23987@uranus.lan> <9d133393-1ea7-c370-24b0-7bb565428b7e@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d133393-1ea7-c370-24b0-7bb565428b7e@virtuozzo.com> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 673 Lines: 14 On Tue, Jun 13, 2017 at 12:45:39PM +0300, Kirill Tkhai wrote: > > > > I'm not that familiar with AIO internals but this snippet worries me: > > the reqs_available is unsigned int, reqs is unsigned it as well but > > used as an accumulator over ALL cpus, can't it get overflow and > > gives modulo result, should not it be unsigned long or something? > > All available reqs are initially contain in kioctx::reqs_available, > which is atomic_t, and then they are distributed over percpu counters. > So, this is OK. Thanks for explanation! Looks ok to me. But I'm far from being aio expert, if someone else won't beat me I'll take a closer look in [a day|couple of] or so.