From patchwork Fri Jan 11 18:55:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10760551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0D4214E5 for ; Fri, 11 Jan 2019 19:00:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D07912A167 for ; Fri, 11 Jan 2019 19:00:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD2E42A170; Fri, 11 Jan 2019 19:00:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F6642A186 for ; Fri, 11 Jan 2019 19:00:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 20D4E8E0004; Fri, 11 Jan 2019 14:00:49 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1BD908E0001; Fri, 11 Jan 2019 14:00:49 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D40F8E0004; Fri, 11 Jan 2019 14:00:49 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id CF73A8E0001 for ; Fri, 11 Jan 2019 14:00:48 -0500 (EST) Received: by mail-pg1-f200.google.com with SMTP id r13so8953604pgb.7 for ; Fri, 11 Jan 2019 11:00:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=X/yCFJqYwjToR1xCd2PErADX2Gd0YDhfcgb+RtSOrEw=; b=WYm5RodqAQomRcim3iacq9mGpNvb10PMHB+unNErpB2WCPrUOUvg9MmBFvA78kC3Tg A9HWD/CQMBVWHjtzmely72f8hkAOG6vyZi4tbf+o1na42Ju1j7vf9oiF6Mea0WI/C308 rAzcdzdo7EZeaU9g9NUvUutA1CilpHzDkrmZa8RtsoqpADStZbh78CZCyihDPPHAQHQR vOXvyFydfjGW615+JYNyJJhg2WItBnXEoa/oSVkxyTaOT8AxPhBAlrz+va9wjpaNjVnm juWhlawcFVY+H4qybS+zOpLfRCiiXd90lUhKHXbCMykj/ltpG688H6qPJ+wuVaTy+saP 0Cnw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: AJcUukdhzS1q86NTJYqppIC+zG1lpjEyfNDpa5fmFfDrpUVkIfS54YPn J4TIwImik8r4XuaYomtbHL6JG4cjjzAa077C/6f9epIHxjZjMxdfRxxq+bFuamxMR9keMKb3S9u Z2ulYow3csNkLU3yspsSFVbTZpCiubdpvPVOyoT5eZQzjnt4uGNuIA6gwaDQ/Ilaw1Q== X-Received: by 2002:a17:902:1102:: with SMTP id d2mr15856592pla.138.1547233248450; Fri, 11 Jan 2019 11:00:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN4nxhSx3sz5FMkgegc2MIG/TZKwdLPASto1HUc+eII50Ft/9d01B7ssetAOuYoDzI1T8rGu X-Received: by 2002:a17:902:1102:: with SMTP id d2mr15856539pla.138.1547233247566; Fri, 11 Jan 2019 11:00:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547233247; cv=none; d=google.com; s=arc-20160816; b=GiFX9mL0Jt7fazZ169UnyHa+Nrm6tJ84E4qNJL3NeFWWRFxEdy6xOP2RWMdkkxBpMR F0bpvnIu1qXstHbR1fe+UHgY9oRRTaf+0oAtLBkrxWHl8YLFp/aUgbLcCMMbK8Q4BIpI zOG6GghSlXzJSY5fJ5I2qZtBwv8Jr1lmnhio5UMgVt9s39gtpFaJgScaCjBMZGl4C1dE rX0wwshb8EVKg0cwi/CrYlc61CKaNL+ryP3o69aZuSaavz9dxN8ZTMqi7BItxFADe4oG 8tY/44BqAFTPoYWfzCOm5hgl7nOpqiUhKIGreBojSxDIFwgWfJyATxE1zzmW1/RduHEJ pkIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=X/yCFJqYwjToR1xCd2PErADX2Gd0YDhfcgb+RtSOrEw=; b=DvOkzeJQmwhoAjuJQPDfOmZbcCbeChS8bmViNwUFiZmur8qwrdaPKYAqvYEYBPOpJo 1uClHgWs97X6OUkJIvq1UHfM/Pgm7VzRLKYVW4cuull8qkwFUArrIm/q2f9HudVOKb4g Sle/H6ZHAG/V5p4V3drOewwIaelfYgCcSy5uQjt6Ip+76B917AaMs9wkwaiK+LYYbpnC xYhRh3pn/28ap5EfFBxTknK6PN9Zdq638viAMMp2u2b/emv8G6Je7/2HamksMW+wQ8DP wbrpNEEQZwGOSkN+bUZfcBHNcJQtjc6Ofbg74bYufSW8IqgVleFBfLVNQ/V9PtsSzVE6 Gbtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com. [47.88.44.36]) by mx.google.com with ESMTPS id e13si17975332pfi.271.2019.01.11.11.00.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 11:00:47 -0800 (PST) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 as permitted sender) client-ip=47.88.44.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0TI2gw9f_1547232913; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TI2gw9f_1547232913) by smtp.aliyun-inc.com(127.0.0.1); Sat, 12 Jan 2019 02:55:20 +0800 From: Yang Shi To: ying.huang@intel.com, tim.c.chen@intel.com, akpm@linux-foundation.org Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: swap: use mem_cgroup_is_root() instead of deferencing css->parent Date: Sat, 12 Jan 2019 02:55:13 +0800 Message-Id: <1547232913-118148-1-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP mem_cgroup_is_root() is preferred API to check if memcg is root or not. Use it instead of deferencing css->parent. Cc: Huang Ying Cc: Tim Chen Signed-off-by: Yang Shi --- include/linux/swap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index a8f6d5d..8739063 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -623,7 +623,7 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) return vm_swappiness; /* root ? */ - if (mem_cgroup_disabled() || !memcg->css.parent) + if (mem_cgroup_disabled() || mem_cgroup_is_root(memcg)) return vm_swappiness; return memcg->swappiness;