Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp167288ybe; Tue, 10 Sep 2019 16:31:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqx31k9eQaH29Pfn9YqpqrBncIwpJSqRBtUG9AVbIZH1PrRdUq+SRKq1+2yYqYxXfStM3iXt X-Received: by 2002:a50:c19a:: with SMTP id m26mr33116752edf.184.1568158271384; Tue, 10 Sep 2019 16:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568158271; cv=none; d=google.com; s=arc-20160816; b=LiUPApb7aVbEBxXitjMxorR4AigYln3fMSCZXCpiDrzzWK+C5dcibMHJtur/08DaOp rPRZBWLgvbwcQghkxO4uoyG//vrjXaxYlnE6F1Nk8vljlxmQqhJhilx4K2fxYmgdz4Ag txQDJOQRl0mVOVW94bGxx8/a7Msxtm4xG12j7ThZiu9w2dXQjXe88o6i+HzGdz8Wb33p eaQbbM14FT4d4rqB3T/uxAIOxMp2CXATXfPbqoC00XBzspVt80FWWLHGPt02GS//iwF0 VkwxdA2wjG2CpsE9LGgTuMPFalj33+kD+PUeKzxfzL4cgtqBhRazD/94l8Zu1YUIgLmR Vhbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oUUiNhAYgPVa+n7rcOh1w/3vTVOmNb/c0QUr1wlOjPY=; b=M4WyOUIMvnHY75vQkbRKuZXuEyg+TnWPh0+UVteui2XCW0CI9BuY6lO8RjASGUcsfg 6p6BAB9cmB1RZhmc3ws0VD8yYPtHGbpK3yn19UtJPVohMNzkTK9RBb6TLfffYOKpQvxU aKLPvnQaSwDMy/dMt80SaK9t9zJEJ6pRaXKx63ErSU6I3C/Nb9soQAEw3mC3VDKoIm0r 5yMWlZ+cmuRspZV65H2IB1/8t2F1W2G9OKlm5aTiNaMoAjV0DcuYCwpEipNCzpS0YhY4 n4boZ9mVqpF3TGQlvi53X4175qOpvszj9VAb8NWCq4oWCGvVb5aLYUI37K7J/Lw/vNbd HqFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b="wjegl/rm"; 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 s11si10412036eja.239.2019.09.10.16.30.37; Tue, 10 Sep 2019 16:31:11 -0700 (PDT) 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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b="wjegl/rm"; 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 S1726245AbfIJX2K (ORCPT + 99 others); Tue, 10 Sep 2019 19:28:10 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:44204 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfIJX2K (ORCPT ); Tue, 10 Sep 2019 19:28:10 -0400 Received: by mail-ed1-f67.google.com with SMTP id p2so17682758edx.11 for ; Tue, 10 Sep 2019 16:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oUUiNhAYgPVa+n7rcOh1w/3vTVOmNb/c0QUr1wlOjPY=; b=wjegl/rmzf8chnaU019SF3I2nksqjHCqVQUT0QuBjb3JPJPcYocdDAbW8IPyAecfon bF4eA333m0GTTmtXYNoHHCvQDXs3E+UwlM+Ft86PX+D4IN/L7v6UK7/My3vmxic45fNE NF4gkJ8Y+jJ9gnx0kCR6gAchhD9Hr43jtUbWrtDAAUbOl16x1BJ4hcTMvKikrTLsMmR7 UuqPQcJ1AqVnlPAyq2lVthpgEFeOzOULF8XEzk9zCKQHTgIIttFlSPIUwnxxS0K1lLIb aO0yBWSy45Zdhmtg9V+OSduCMutLdBIyEUs2Zjfw9//kJOaIBCClFwonz35vyuyuVpcq 6yEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oUUiNhAYgPVa+n7rcOh1w/3vTVOmNb/c0QUr1wlOjPY=; b=NkgmxccamqXN1brBbhua/jDtouTKz/mIG1rNBujCn83YAhK8q5lSCdCb7YlR4OBvXk guwfgwoyLI7x5hAEsvDvwunrPY0L96L0HTJGYkGfWPIJp0YFY/tiEHpXgUyrxBRaS28/ ERc7aaHxgIb2sXOm+94/b3E+hVjNjEu6nEowNgTF748pXyGmkekLd+qokzhCZ99ZHRSr jXi52CNoY5dzKounkpktcRoIaDeciQISLqCdoQtJLZCnyCgSQ7xXzgbomfCpPtArnKVj mPx+q/gx1gTwTbXQtHsW06YqvhZy1xFRLVO+CJf68DTo9Zb0CHlK5IiNr9WMBKdc/vs4 Q4vw== X-Gm-Message-State: APjAAAVUM42M5zskDQ43QusHiQq92OLwy8GcINmfryIAMDfkEnJz7MRl iv2LSZpSutTKAtoVj77IGiKJkw== X-Received: by 2002:a17:906:3446:: with SMTP id d6mr8523490ejb.244.1568158088641; Tue, 10 Sep 2019 16:28:08 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id ns21sm2252371ejb.49.2019.09.10.16.28.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Sep 2019 16:28:07 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 5C20E10416F; Wed, 11 Sep 2019 02:28:08 +0300 (+03) Date: Wed, 11 Sep 2019 02:28:08 +0300 From: "Kirill A. Shutemov" To: Tetsuo Handa Cc: Mike Christie , axboe@kernel.dk, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Linux-MM Subject: Re: [RFC PATCH] Add proc interface to set PF_MEMALLOC flags Message-ID: <20190910232808.zqlvgnuym6emvdyf@box.shutemov.name> References: <20190909162804.5694-1-mchristi@redhat.com> <5D76995B.1010507@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 11, 2019 at 07:12:06AM +0900, Tetsuo Handa wrote: > >> +static ssize_t memalloc_write(struct file *file, const char __user *buf, > >> + size_t count, loff_t *ppos) > >> +{ > >> + struct task_struct *task; > >> + char buffer[5]; > >> + int rc = count; > >> + > >> + memset(buffer, 0, sizeof(buffer)); > >> + if (count != sizeof(buffer) - 1) > >> + return -EINVAL; > >> + > >> + if (copy_from_user(buffer, buf, count)) > > copy_from_user() / copy_to_user() might involve memory allocation > via page fault which has to be done under the mask? Moreover, since > just open()ing this file can involve memory allocation, do we forbid > open("/proc/thread-self/memalloc") ? Not saying that I'm okay with the approach in general, but I don't think this a problem. The application has to set allocation policy before inserting itself into IO or FS path. -- Kirill A. Shutemov