Received: by 10.213.65.68 with SMTP id h4csp2489978imn; Mon, 9 Apr 2018 04:28:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+rHDe4E657M2GJL3fGLEE+UP3pG5D1fQ8NInK4/7lA5ZLxD0h8/Ir1MomzC7D1WBI5JauL X-Received: by 10.99.114.86 with SMTP id c22mr24437864pgn.72.1523273325361; Mon, 09 Apr 2018 04:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523273325; cv=none; d=google.com; s=arc-20160816; b=E8zHX//h+embX55gQIsBvakB76SH99rH0XISTzAbzLcEyhdzcNFQ2X1Tj2oJpBHzeF wsoPADqvayoAldrk7I67X4Civ+dp2WNuCEF4dquWTXzODilMB2vtAL5eZ/e+vYy+Kk/M 5kHkk5yNazYkW8eCXEswpLcfLvY/IHSC1WOOLESMZTu98pdGCpJVl9JGX4pZ6oN5CE80 ZQfT1u/+vBUxQG/zvJuMS3V7++zAdfpkARUrmYFOAInZhOzUyMAhRIKDvRC1ifbsgTO2 eZXkJ65NEU4i6HzWT15OxF5mnt97cO/WhyTdcq94g0DfoFEhkCHJTSwttTcFKNPq9ycr DX4g== 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:arc-authentication-results; bh=8Vy0bJclHayWynBhCF12CTaq3dmd4i/xiLppeOc/aCw=; b=n2C3HQxvRfgpkFYcyPyGxjLrHhwaTUbwnuOmY0BhgTZZ/QkhwbcRqtpLADaaJSoRjE wuAZfh36wcgJmw26XDf/S7XMERRYSpg4rnM3jVrDLuyKCXK5nM1NTBfA6FeyLqefkKaO 5JlHcF7CbKCZkCGNnLoPM5poOSKgtLyWpw6kTH7+VXtqV1hTfP1SIQQkKcswetQM03Kw cm83vUGPQxYTPFKtq1V/wUxmtUZlh+7z9GKZtZR1RRCwu9wh3cGDzGzuWaTMHEQeUbo8 F8MZx3oYZVvWRhLWWaXsIaUMsv89dQABYFOoNWLsZJ07Lwn8x7Hv//mZvJxXrCI5UJYC G4MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ANApxEBB; 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 k15si71945pfh.12.2018.04.09.04.28.07; Mon, 09 Apr 2018 04:28:45 -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=fail header.i=@gmail.com header.s=20161025 header.b=ANApxEBB; 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 S1751550AbeDILZ0 (ORCPT + 99 others); Mon, 9 Apr 2018 07:25:26 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:38145 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750982AbeDILZY (ORCPT ); Mon, 9 Apr 2018 07:25:24 -0400 Received: by mail-pl0-f66.google.com with SMTP id c7-v6so1675791plr.5; Mon, 09 Apr 2018 04:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8Vy0bJclHayWynBhCF12CTaq3dmd4i/xiLppeOc/aCw=; b=ANApxEBBkirbA4TZ4vJusH2pLb6KeRVZw2ZLlYw8678C2qBo4XAB7gRuygN2266S84 oNtDsLMS+J7uyLf6WU3MspLJnmttc7zapwtjbm8MfA0Egkid7Fpm7rWPMKg4inZ8muHN 2Bt9MjvzKMM/iNfJ26qfI55v13vNKA4hjRkTGBzYzosTcOe1WLXOBd5c+xo7akFLl9WA cnlL08+uJyTSBTUV9ik03Oot3g1odB/foxECkfE7M+iExqcVfFMYwLvYGRtkuHa7sN72 l30BoEp7gvymGYdqhlrjz1AzQ05jxsFTNkG5T3IZ114GITG4to6zNWU1M+bgSRdqXDlM B3Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=8Vy0bJclHayWynBhCF12CTaq3dmd4i/xiLppeOc/aCw=; b=XUcuINwTzzrgQ+HLARzl//0I/Wu69+Yz6sFsj9gIm8Pfk3i9q1Ip0QOWbAwxj/8P8n WKguFdlJkE8eZq4t6h43aFGXAEIqyJaFhaL1c2TlaVgsGjaP0HIhuhsUaxdIzTY4kvm3 eZnKZHsOzq7gUMb6Mf6cUSmigVQY+kDU6cCizDHg5PHM2PjcMmHI81dzr9I/hdFRgq72 sRc7cyiRdroJQUBKlX9DHD08mhuHDzOtMwfurdKoNygujMp6v3E0IzzPpPTRraFhOSoX UJenkUonSHWBtx6KsrIRmQiF0cTZI6mjHiM0r1AuimaNk3Os5pOtDI/WnU9thS5vByR+ VcTw== X-Gm-Message-State: ALQs6tAtwl2TC3XcBffpfXlrAtKIOHgsCRl6I6EmdsVnS1a9+GthweQu V6ej+0TfPNwAlw/UGxXe4XM= X-Received: by 2002:a17:902:6b04:: with SMTP id o4-v6mr20074702plk.332.1523273124185; Mon, 09 Apr 2018 04:25:24 -0700 (PDT) Received: from rodete-laptop-imager.corp.google.com ([122.38.223.241]) by smtp.gmail.com with ESMTPSA id c186sm342866pfb.40.2018.04.09.04.25.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Apr 2018 04:25:22 -0700 (PDT) Date: Mon, 9 Apr 2018 20:25:14 +0900 From: Minchan Kim To: Matthew Wilcox , Jaegeuk Kim Cc: Christopher Lameter , Andrew Morton , linux-mm , LKML , Johannes Weiner , Jan Kara , Chris Fries , Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] mm: workingset: fix NULL ptr dereference Message-ID: <20180409112514.GA195937@rodete-laptop-imager.corp.google.com> References: <20180409015815.235943-1-minchan@kernel.org> <20180409024925.GA21889@bombadil.infradead.org> <20180409030930.GA214930@rodete-desktop-imager.corp.google.com> <20180409111403.GA31652@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180409111403.GA31652@bombadil.infradead.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 09, 2018 at 04:14:03AM -0700, Matthew Wilcox wrote: > On Mon, Apr 09, 2018 at 12:09:30PM +0900, Minchan Kim wrote: > > On Sun, Apr 08, 2018 at 07:49:25PM -0700, Matthew Wilcox wrote: > > > On Mon, Apr 09, 2018 at 10:58:15AM +0900, Minchan Kim wrote: > > > > It assumes shadow entry of radix tree relies on the init state > > > > that node->private_list allocated should be list_empty state. > > > > Currently, it's initailized in SLAB constructor which means > > > > node of radix tree would be initialized only when *slub allocates > > > > new page*, not *new object*. So, if some FS or subsystem pass > > > > gfp_mask to __GFP_ZERO, slub allocator will do memset blindly. > > > > > > Wait, what? Who's declaring their radix tree with GFP_ZERO flags? > > > I don't see anyone using INIT_RADIX_TREE or RADIX_TREE or RADIX_TREE_INIT > > > with GFP_ZERO. > > > > Look at fs/f2fs/inode.c > > mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_ZERO); > > > > __add_to_page_cache_locked > > radix_tree_maybe_preload > > > > add_to_page_cache_lru > > > > What's the wrong with setting __GFP_ZERO with mapping->gfp_mask? > > Because it's a stupid thing to do. Pages are allocated and then filled > from disk. Zeroing them before DMAing to them is just a waste of time. Every FSes do address_space to read pages from storage? I'm not sure. If you're right, we need to insert WARN_ON to catch up __GFP_ZERO on mapping_set_gfp_mask at the beginning and remove all of those stupid thins. Jaegeuk, why do you need __GFP_ZERO? Could you explain?