Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1743365imu; Thu, 10 Jan 2019 02:12:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN6DEZthqrn6lUhx7w+VvrbDQNQKBlj4boaYSmTrBEWVQLyqVzNRlkPBhD2iQ+3N33SFrgH8 X-Received: by 2002:a63:1408:: with SMTP id u8mr8874028pgl.271.1547115129149; Thu, 10 Jan 2019 02:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547115129; cv=none; d=google.com; s=arc-20160816; b=zwQNzWP37gqPXWOq1nw1y54D4umm18b28grHX+4ox/RLRD3VRUoSaoGT57jZnh4T/5 VNz1glkrGdSpXURuiQA+5Y4Q2kGDWgq07Fsqw+LFh8PfTn3NgrrNyM2cjD/EISr2T6sH 1kylgYuf36jUWxQyaeiK7Kd5IRJl8FnxEr/ZTceFN9v8pVDaNp+wz7NjEKSxtMW9rF/L yBTtmULiMZImMhg2aVpjv+tVjbFLIqR0lM3+iIcYjotaGkWVDeiI8njfMP75y4CS0s2U tBHSCe0LLby2BOsJFau1W/beriG//6VKkI+23ynkAKPqkTJwkowV36k/hS2FA60INz+V 8BBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=wJSEKf3CCfjXb6MWFjWN0vYhGTsLcL+a26J956976X8=; b=HJUhkbYTwg9vNJesyn+YIGNzVtUFjZpnl/Qj+iL7Tev+cG4mmvB4uwSgEOeQSuLNrd jaZ/PFmtn3IwkLaGxcEXDDD2PA8IuCb4siRwLT5X+EeKwpCwdBIXyRArJkyhxHv/+65m OcEJ2qw73xUjyf1cvqf3dUQc7LWlW3KBP92V0YF2uKdRO62yoQxgkJhX+LQwWQzLNBKu llpCOA9pvSrVScR+gJI4XkR3DBApELpPdY08FhCNk518CyWfTFcONnG/i3sKtP7l1Eo0 MlpDg/sdxr7Pdd5MJ7EEUywDvZgrgVQ4AyNu+qIx6TeTmIRoBwpaKt5w58MiDNr6CUZu 8Tjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h19si22664215pgg.274.2019.01.10.02.11.53; Thu, 10 Jan 2019 02:12:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728030AbfAJKDx (ORCPT + 99 others); Thu, 10 Jan 2019 05:03:53 -0500 Received: from mx2.suse.de ([195.135.220.15]:35496 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727780AbfAJKDx (ORCPT ); Thu, 10 Jan 2019 05:03:53 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 97673ACD1; Thu, 10 Jan 2019 10:03:51 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 10 Jan 2019 11:03:51 +0100 From: Roman Penyaev To: Linus Torvalds Cc: Andrew Morton , Davidlohr Bueso , Jason Baron , Al Viro , "Paul E. McKenney" , Andrea Parri , linux-fsdevel , Linux List Kernel Mailing Subject: Re: [RFC PATCH 09/15] epoll: introduce stand-alone helpers for polling from userspace In-Reply-To: References: <20190109164025.24554-1-rpenyaev@suse.de> <20190109164025.24554-10-rpenyaev@suse.de> Message-ID: <6f86fe7564d3bb088c2c73f8d699bc71@suse.de> X-Sender: rpenyaev@suse.de User-Agent: Roundcube Webmail Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-01-09 18:29, Linus Torvalds wrote: > On Wed, Jan 9, 2019 at 8:40 AM Roman Penyaev wrote: >> >> ep_vrealloc*() >> realloc user header, user index or bitmap memory > > What? No. > > This is wrong, it's much too complicated. And because your > 'vrealloc()' doesn't follow the normal realloc rules, it looks both > confusing and buggy, and people have to remember that "oh, vrealloc() > isn't actually vrealloc(), it's really vdupalloc()". > > Your other patch to allow users to apparently also do mremap of these > things seems entirely wrongheaded too. Especially when you then have > magical rules for vm_pgoff, which is one of the things that unmapping > parts of a mmap will touch. > > So I say no, no, no. This is all *much* too complicated, and the > interfaces are mis-designed to be overly generous to people doing odd > and pointless things. > > If you can't have a fixed-size user buffer that stays in one place, > don't even bother. I agree that set of "rules" for this interface is indeed complicated. The goal was to solve the problem with a constantly changing set of items (which can be increased / decreased from another thread) without adding new ctl calls or any limitations. To fix the size of a user buffer is seems easy to do. One way is still to support expand with, say, epoll_ctl(EPOLL_CTL_EXPAND) call and user has to react explicitly on ENOSPC from epoll_ctl(EPOLL_CTL_ADD). Thus reallocation happens, but by user request. Another way seems much simpler but has a limitation: user has to specify expected max limit passing the value to a new epoll_create syscall, e.g. epoll_create2(EPOLL_USERPOLL, 1000). Further attempt to add 1001 descriptor will end with ENOSPC. Period. No magic under the hood. Another 1001 descriptor can be added to a new epoll, which can be nested then (what is forbidden for "polled from user" descriptors in current implementation, but should not be difficult to allow). Then yes, no remapping / reallocating. But this epoll nesting thing ... Which personally I do not like. What do you think? -- Roman