Received: by 10.192.165.156 with SMTP id m28csp1138398imm; Wed, 18 Apr 2018 04:57:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx48MuWYh0S/3E0tC/1/UWUhwaDGREeZG3mf9WpKJqYKW+xWGcPgc31xcEQtgKxeA1uq/4g1f X-Received: by 2002:a17:902:564:: with SMTP id 91-v6mr1808209plf.63.1524052659499; Wed, 18 Apr 2018 04:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524052659; cv=none; d=google.com; s=arc-20160816; b=uXmitEmll8BDC2IJ7UnzkJDUAYdYGrhKmHNjfieKEn2VRKzvw0jy3Fe3ToS6JGbFde +FNfMTnv/340rbNJdAf7hLoIaM7hwve1SSYiFvyv+xPCbRVItxZ+wZ3yvbz6C5JgrjDm ldbZkXi8C0Uqr8ofjasjxOJbH43k01M56/Cg36jlFArTWBZOXuDYBSMrpDXUsCT2fSx9 XntjDBobe2keCuDFnmTRosOEF5hUXODOy+Xk8FfUoaXhv4MG0mrIlCyWalXwqE482eLR g3ucV8TrYpyNt5aIZn9YPufsbohT7y8pzXIR1dfrfY/Xl4PziogF+TbHcv2JPjPm6GlE arhw== 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:arc-authentication-results; bh=fasuu0OrDdgDvVjOuNf/tV2Q6ySIQwgbnh78mZkwtzM=; b=Lxs8fYUrWbKpfqvMjI4+Kg9ZddK9kMWJu/PLwPLYLVk31rK4LhaS/jOMqRMuzBkQsR 6ZETfKpquXenoLae8HYgeHl+u0D7vD3aPuUi/gN+Gds2vAGx6YsSZUBDXcRtWj9Os+MR nTTDg8X7Pul11YexxJJy8J7j3fgIIPNjkkmM0OfdF+r9qSmvAY+t/v+wAhTLSCllv+9B 1yhTmo4HIFFM5VTyHL7F7bwojA9/RlWvry2DDmG7cT9nb3/FkUOUGaV3jgus+KBQOUTt 9vcsItJ2jqgobEMAhbb41soCM4tEiOUhAdnHvzP9c0gHuR349Jd33NFKJxMlDoQTPMSR +56w== 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 j1si1015148pff.7.2018.04.18.04.57.25; Wed, 18 Apr 2018 04:57:39 -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; 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 S1753953AbeDRLzt (ORCPT + 99 others); Wed, 18 Apr 2018 07:55:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:55041 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753937AbeDRLzs (ORCPT ); Wed, 18 Apr 2018 07:55:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 74EA8ADA7; Wed, 18 Apr 2018 11:55:47 +0000 (UTC) Date: Wed, 18 Apr 2018 13:55:46 +0200 From: Michal Hocko To: Tetsuo Handa Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] fs, elf: drop MAP_FIXED usage from elf_map Message-ID: <20180418115546.GZ17484@dhcp22.suse.cz> References: <20171213092550.2774-1-mhocko@kernel.org> <20171213092550.2774-3-mhocko@kernel.org> <0b5c541a-91ee-220b-3196-f64264f9f0bc@I-love.SAKURA.ne.jp> <20180418113301.GY17484@dhcp22.suse.cz> <201804182043.JFH90161.LStOOMFFOJQHVF@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201804182043.JFH90161.LStOOMFFOJQHVF@I-love.SAKURA.ne.jp> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 18-04-18 20:43:11, Tetsuo Handa wrote: > Michal Hocko wrote: > > > Don't complain if IS_ERR_VALUE(), > > > > this is simply wrong. We do want to warn on the failure because this is > > when the actual clash happens. We should just warn on EEXIST. > > >From 25442cdd31aa5cc8522923a0153a77dfd2ebc832 Mon Sep 17 00:00:00 2001 > From: Tetsuo Handa > Date: Wed, 18 Apr 2018 20:38:15 +0900 > Subject: [PATCH] fs, elf: don't complain MAP_FIXED_NOREPLACE unless -EEXIST > error. > > Commit 4ed28639519c7bad ("fs, elf: drop MAP_FIXED usage from elf_map") is > printing spurious messages under memory pressure due to map_addr == -ENOMEM. > > 9794 (a.out): Uhuuh, elf segment at 00007f2e34738000(fffffffffffffff4) requested but the memory is mapped already > 14104 (a.out): Uhuuh, elf segment at 00007f34fd76c000(fffffffffffffff4) requested but the memory is mapped already > 16843 (a.out): Uhuuh, elf segment at 00007f930ecc7000(fffffffffffffff4) requested but the memory is mapped already > > Complain only if -EEXIST, and use %px for printing the address. Yes this is better. But... [...] > - if ((type & MAP_FIXED_NOREPLACE) && BAD_ADDR(map_addr)) > - pr_info("%d (%s): Uhuuh, elf segment at %p requested but the memory is mapped already\n", > - task_pid_nr(current), current->comm, > - (void *)addr); > + if ((type & MAP_FIXED_NOREPLACE) && map_addr == -EEXIST) ... please use PTR_ERR(map_addr) == -EEXIST then you can add Acked-by: Michal Hocko > + pr_info("%d (%s): Uhuuh, elf segment at %px requested but the memory is mapped already\n", > + task_pid_nr(current), current->comm, (void *)addr); > > return(map_addr); > } > -- > 1.8.3.1 -- Michal Hocko SUSE Labs