Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2395360imu; Tue, 6 Nov 2018 13:54:49 -0800 (PST) X-Google-Smtp-Source: AJdET5fLXikD6+GGgTZVnLfqNO3G9gN7+ebKtJeA0FilKtUlmTTmuMLbfP8mR2mVDmHWeVa0q0GW X-Received: by 2002:a63:2f07:: with SMTP id v7mr23819378pgv.368.1541541288950; Tue, 06 Nov 2018 13:54:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541541288; cv=none; d=google.com; s=arc-20160816; b=SUet1FGqOL1Kxd/BilwbOKGb7U0isSl4+/YAs5jJH0bQB839cUX4PNiurpqphr0UW5 08vCZU4Q7Al7j8ecsle9t/M+XTbs7dd/zMxsg/G0oMYUax1TOv5y/xVnSDyEffzdVU/A k7xpQHhaU1sn3MY0v+Xt3CK9XRDhbU2FqfgANcEqScx5uXOKrdIni0/Re38jtaQas6ER t3fXt/9NmyhuTzPN8Jlp7pj5KIm+IR4BsLNhjINrkTreUGIDvL07P5SsDxxVujzU95lU yd/eUVPUuR26X19gYsqyrW0JE+2NqXV1VOZhVc2xDpLXbL3srarF3cKIOuRzxJUbGaEH YhYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=4SUdyTMUriYoQkXiZpvMVRoeAOEJtGgq0SNjYRh0awk=; b=XMjvSeken+ycbKdgzE+RR1OHdoxwZN9peZinHy0F0GBOkd/BNhpWXoiPxL46wvfw9N dtQdoJgeq8zXLrTv2qMVHRacZc5uYIhYW/4TaCby8kz51xNPam/Tet7gmG6sfLosQ7Hg pSPtiDmvSkpkb8m/YAtHxg/F+ahptZhZWIcgfczLEF5++JV5Qrxldx8ld50JIBNKzZI6 cFbQNY6bSHALSzSp3XG0YTNFVn91zbV3MT6QBVFVxRHyftJZcRfkcFIUpioOLTpvLsFH BrbTwVPSBdsANq1SLzdPFYwojzoiyMUH8RzdLscdaWBstdz0QknLgWhODCn2x/8DPMG+ hIRA== 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 u12-v6si8926354plr.104.2018.11.06.13.54.33; Tue, 06 Nov 2018 13:54:48 -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 S1727324AbeKGHSm (ORCPT + 99 others); Wed, 7 Nov 2018 02:18:42 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:56612 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbeKGHSm (ORCPT ); Wed, 7 Nov 2018 02:18:42 -0500 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7F827A48; Tue, 6 Nov 2018 21:51:23 +0000 (UTC) Date: Tue, 6 Nov 2018 13:51:21 -0800 From: Andrew Morton To: William Kucharski Cc: miles.chen@mediatek.com, Michal Hocko , Joe Perches , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, wsd_upstream@mediatek.com, Michal Hocko Subject: Re: [PATCH v4] mm/page_owner: clamp read count to PAGE_SIZE Message-Id: <20181106135121.dd015f188709c4ccb2bff52c@linux-foundation.org> In-Reply-To: References: <1541091607-27402-1-git-send-email-miles.chen@mediatek.com> <20181101144723.3ddc1fa1ab7f81184bc2fdb8@linux-foundation.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Nov 2018 18:41:33 -0600 William Kucharski wrote: > > > > On Nov 1, 2018, at 3:47 PM, Andrew Morton wrote: > > > > - count = count > PAGE_SIZE ? PAGE_SIZE : count; > > + count = min_t(size_t, count, PAGE_SIZE); > > kbuf = kmalloc(count, GFP_KERNEL); > > if (!kbuf) > > return -ENOMEM; > > Is the use of min_t vs. the C conditional mostly to be more self-documenting? Yup. It saves the reader from having to parse the code to figure out "this is a min operation".