From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Shi Subject: Re: [PATCH v17 17/21] mm/lru: replace pgdat lru_lock with lruvec lock Date: Wed, 29 Jul 2020 08:48:00 +0800 Message-ID: References: <1595681998-19193-1-git-send-email-alex.shi@linux.alibaba.com> <1595681998-19193-18-git-send-email-alex.shi@linux.alibaba.com> <1fd45e69-3a50-aae8-bcc4-47d891a5e263@linux.alibaba.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="utf-8" To: Alexander Duyck Cc: Andrew Morton , Mel Gorman , Tejun Heo , Hugh Dickins , Konstantin Khlebnikov , Daniel Jordan , Yang Shi , Matthew Wilcox , Johannes Weiner , kbuild test robot , linux-mm , LKML , cgroups@vger.kernel.org, Shakeel Butt , Joonsoo Kim , Wei Yang , "Kirill A. Shutemov" , Rong Chen , Michal Hocko , Vladimir Davydov 在 2020/7/28 下午11:55, Alexander Duyck 写道: >> /* >> @@ -511,11 +511,11 @@ static bool compact_lock_irqsave(spinlock_t *lock, unsigned long *flags, >> * scheduled) >> */ >> static bool compact_unlock_should_abort(spinlock_t *lock, >> - unsigned long flags, bool *locked, struct compact_control *cc) >> + unsigned long flags, void **locked, struct compact_control *cc) > Instead of passing both a void pointer and the lock why not just pass > the pointer to the lock pointer? You could combine lock and locked > into a single argument and save yourself some extra effort. > the passed locked pointer could be rewrite in the func, that is unacceptable if it is a lock which could be used other place. And it is alreay dangerous to NULL a local pointer. In fact, I perfer the orignal verion, not so smart but rebust enough for future changes, right? Thanks Alex >> { >> if (*locked) { >> spin_unlock_irqrestore(lock, flags); >> - *locked = false; >> + *locked = NULL; >> } >> >> if (fatal_signal_pending(current)) {